Re: Call IDL (Virtual Machine) Save file from Java [message #55817] |
Wed, 12 September 2007 00:22  |
raval.chintan
Messages: 54 Registered: May 2005
|
Member |
|
|
On Sep 11, 7:55 pm, Nigel Wade <n...@ion.le.ac.uk> wrote:
> raval.chin...@gmail.com wrote:
>> Hi,
>
>> I made one application for which some part I have developed in IDL.
>> For this application I made save file in IDL which run correctly If I
>> run it through command prompt on Windows with the command given below.
>
>> idlrt -vm "D:\myapp.sav"
>
>> I made a bat file simple.bat. which contain the same above command.
>> When I run this bat file from the command prompt my application is
>> running fine.
>
>> The entire application is in Java. I have only installed IDL virtual
>> machine on my Windows XP machine. and I have written following code in
>> Java to call the application.
>
>> Runtime r=Runtime.getRuntime();
>> Process p=null;
>> try
>> {
>> String s="D://simple.bat";
>
>> p=r.exec(s);
>> }
>
>> catch(Exception e){
>> System.out.println("error==="+e.getMessage());
>> e.printStackTrace();
>> }
>
>> But the problem comes when I try to run the code from Java file. I am
>> not able to run IDL application. At the same time one good thing I
>> found in above code , It is not generating any error :-).
>
>> Appriciate If you could help me in this regard.
>
>> -Chintan
>
> You can't execute a bat file directly, it needs cmd.exe to run it. Modify your
> Java to use the alternative exec() method which takes a String[]:
>
> String[] s = new String[] { "cmd.exe", "D:/simple.bat" };
>
> You may or may not need the /c flag, I don't know cmd.exe well enough to say. If
> you do just add it to the array:
>
> String[] s = new String[] { "cmd.exe", "/c", "D:/simple.bat" };
>
> P.S.
> You should only need a single "/" in the path, it's "\" which needs to be
> escaped by "\".
>
> --
> Nigel Wade, System Administrator, Space Plasma Physics Group,
> University of Leicester, Leicester, LE1 7RH, UK
> E-mail : n...@ion.le.ac.uk
> Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555- Hide quoted text -
>
> - Show quoted text -
Hi Nigel,
Thank you for your reply. I have tried the suggestion that you have
provided but I do not get success in running my program.
I find that When I am writing idlrt -vm myaap.sav command in
simple.bat file, my code is not running and same time its not giving
me any error.But when I am writing only myaap.sav in simple.bat file
my application is ruuning fine.
Now the thing is that .. after changing my simple.bat file my work is
done ... But I do not know why it is not running when I am running my
application through idlrt -vm myapp.sav file :-).
Once again Thank you for your reply.
Regards
Chintan
|
|
|