aspose file tools*
The moose likes Java in General and the fly likes Runtime.exe()  is not working from a jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Runtime.exe()  is not working from a jar file" Watch "Runtime.exe()  is not working from a jar file" New topic
Author

Runtime.exe() is not working from a jar file

Khushwinder Chahal
Ranch Hand

Joined: Oct 03, 2007
Posts: 128
Hi All,

I have a jar file which have classes and a package in it.
One of these classes is calling another class which is present in the package.
The code i am using it is as follows:
Runtime r=Runtime.getRuntime();


It is working fine when i am executing it without making jar file.
But when i make a jar file of all these things , this exec() is not working.
I have tried a lot.
If any body has any idea suggest me.
Thanks


Khushwinder
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41820
    
  62
While you don't say what "not working" means, I think it may be a classpath issue. Make sure the subprocess knows where to find all required classes.

By the way, are you properly handling input/output/error streams for the subprocess?


Ping & DNS - my free Android networking tools app
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38788
    
  23
Originally posted by Ulf Dittmer:
. . . By the way, are you properly handling input/output/error streams for the subprocess?
If you search through the Ranch you find old threads like this one with links to Daconta's article, and also look at the ProcessBuilder class which makes it a bit easier by merging the output and error streams.
Khushwinder Chahal
Ranch Hand

Joined: Oct 03, 2007
Posts: 128
thanks for your valuable suggestions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Runtime.exe() is not working from a jar file