Re: Running SML with java program, errors

John Reppy <[email protected]> Tue, 2 Feb 2010 12:22:37 -0600
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
I guess we need to see the ML code too.  Also, the full transcript would
be useful.

BTW, can you run the BAT file from Java?

	- John

On Feb 2, 2010, at 12:02 PM, jt pe wrote:

> The Java call is:
> 
> 
>  Runtime r = Runtime.getRuntime();
>         
> try {
> 
>  
>             proc = r.exec(Command, Environment, WorkingDir);
>            }
> ...
> 
> 
> where:
> 
>         Command        = new
>  String[3];
>         Command[0]     = 
> "C:\\sml\\bin\\.run\\run.x86-win32.exe"
> ;
>         Command[1]     = 
> "@SMLload=C:\\sml\\bin\\.heap\\sml.x86-win32"
> ;
>         Command[2]     = 
> "stabilizeParser.sml"
> ;
>  
>         Environment    = 
> new String[3];    // Constant Environment 
> 
>         Environment[0] = 
> "PATH=C:/sml/bin/"
> ;
>         Environment[1] = 
> "CM_PATH=C:/sml/lib/"
> ;
>         Environment[2] = 
> "SMLNJ_HOME=C:/sml/"
> ;
> 
> 	
> 	WorkingDir = new File("C:\\foo");
> 
> 
> Yes, I am invoking CM in foo.sml.
> But remember, this all seems to work from the .bat file (given the same arguments as Java).
> 
> 
> I am still experimenting with it.
> 
> Thanks for any more insight you can provide.
> 
> -JT
> 
> 
> > Subject: Re: [Smlnj-list] Running SML with java program, errors
> > From: [email protected]
> > Date: Mon, 1 Feb 2010 18:04:23 -0600
> > CC: [email protected]
> > To: [email protected]
> > 
> > What does the Java code look like? It appears that CM is trying to run ml-lex, are
> > you invoking CM in foo.sml?
> > 
> > - John
> > 
> > On Feb 1, 2010, at 1:06 PM, jt pe wrote:
> > 
> > > I am trying to run a .sml program through java.
> > > 
> > > First i tried using a simple bat file to run it..
> > > 
> > > 
> > > {// inside bat file
> > > 
> > > 
> > > 
> > > // Setting variables
> > > 
> > > SET WorkingDir = 
> > > "C:\foo\"
> > > 
> > > SET SML = 
> > > "C:\sml\bin\.run\run.x86-win32.exe"
> > > 
> > > SET SML_LOAD = 
> > > "C:\sml\bin\.heap\sml.x86-win32"
> > > 
> > > 
> > > 
> > > CD =%WorkingDir%
> > > 
> > > 
> > > // command to run:
> > > 
> > > %SML% @SMLload=%SML_LOAD% foo.sml
> > > 
> > > }
> > > 
> > > 
> > > Anyhow, it works just fine with the bat command.
> > > 
> > > But, when I try it in java it gives me an error:
> > > 
> > > !* CM error: ML-Lex failed: ml-lex target_tokens.spec
> > > 
> > > 
> > > I believe everything on the Java side is working.. (i am asking Java forums as well) 
> > > I can run other SML code from java. (though the other examples do not utilize "@SMLload=" or ""C:\sml\bin\.run\run.x86-win32.exe"")
> > > 
> > > 
> > > Does any one know of any issues that may be arising due to calling the program through java?
> > > 
> > > Thanks
> > > 
> > > -JT
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. Sign up now. ------------------------------------------------------------------------------
> > > The Planet: dedicated and managed hosting, cloud storage, colocation
> > > Stay online with enterprise data centers and the best network in the business
> > > Choose flexible plans and management services without long-term contracts
> > > Personal 24x7 support from experience hosting pros just a phone call away.
> > > http://p.sf.net/sfu/theplanet-com_______________________________________________
> > > Smlnj-list mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/smlnj-list
> > 
> 
> Hotmail: Trusted email with powerful SPAM protection. Sign up now.


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com