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
Joined: Mar 22, 2005
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?
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.