This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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
 
Rancher
Posts: 42975
76
  • 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?
 
Marshal
Posts: 58378
178
  • 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
Boost this thread!