• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

java.lang.Process process.exitValue() return 9

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

While i am executing the following code, i am getting the exitvalue as 9 instead of 0.

Process process = null;
InputStream inStream = null;
try {
process = Runtime.getRuntime().exec(command);
process.waitFor();
int exitValue = process.exitValue();
log.debug("Process has exited (exit value={})", exitValue);

}.....

I am getting the exitValue as 9 instead of 0. Can any one help me on this.

If i comment the process.waitFor(); line, the system throws InterruptedException.


Thanks
Madhu
 
Marshal
Posts: 69837
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely the 9 depends on which program you are invoking?
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

madhusudhanan anna wrote:
While i am executing the following code, i am getting the exitvalue as 9 instead of 0.



Then that is the exit value of the command. You need to look into that command's documentation and find out what its exit codes mean and what might cause it to return 9.
 
madhusudhanan anna
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

My environment is Sun Solaris X86.

If i execute this code in a standalone program it works fine.

If i put the above code in my project and run in the glassfish server, i am getting this error.

Thanks
Madhu
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

madhusudhanan anna wrote:Hi

My environment is Sun Solaris X86.

If i execute this code in a standalone program it works fine.

If i put the above code in my project and run in the glassfish server, i am getting this error.

Thanks
Madhu



You need to look into that command's documentation and find out what its exit codes mean and what might cause it to return 9.
 
Campbell Ritchie
Marshal
Posts: 69837
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nor can I, but shall we get back to the official subject of this thread?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:shall we get back to the official subject of this thread?



Not sure what else there is to be said at this point. All we know is that some unknown process runs fine from a standalone but gives exit code 9 in glassfish. I think the ball is in the OP's court now.
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've removed a few posts that were going off topic, as I feel that madhusudhanan anna's issue isn't resolved yet. Moving this thread to MD would probably mean the issue would never be resolved, and that's not what the Ranch is about.

Speaking of the original issue, madhusudhanan anna, can you tell us what the value of command is? Perhaps you've included some shell operators; java.lang.Process can't handle those itself.
 
A wop bop a lu bop a womp bam boom! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic