Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Khushwinder Chahal
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50240
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your valuable suggestions
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic