comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Call IDL (Virtual Machine) Save file from Java
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Call IDL (Virtual Machine) Save file from Java [message #55817] Wed, 12 September 2007 00:22
raval.chintan is currently offline  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
Re: Call IDL (Virtual Machine) Save file from Java [message #55828 is a reply to message #55817] Tue, 11 September 2007 07:55 Go to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
raval.chintan@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 : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
Re: Call IDL (Virtual Machine) Save file from Java [message #55830 is a reply to message #55828] Tue, 11 September 2007 07:07 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Sep 11, 7:25 am, 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

So it doesn't work... what DOES it do?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Ambiguous keyword abbreviation error
Next Topic: array operations

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 23:51:32 PDT 2025

Total time taken to generate the page: 1.11523 seconds