This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes Retun value of Runtime.exec in linux 32 bit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Retun value of Runtime.exec in linux 32 bit" Watch "Retun value of Runtime.exec in linux 32 bit" New topic
Author

Retun value of Runtime.exec in linux 32 bit

Anil kumar P
Greenhorn

Joined: Jan 16, 2008
Posts: 2
hi
From my standalone java application an exe is invoked, which retuns
value till 255.
But in linux 32 bit environment, if the return value
is above 128, then it is returning -1, not the actual value.

Process process = Runtime.exec(".sh file invoking the exe");
int return = process.waitFor();
return variable is having -1, if value is greater than 128.

If the above exe is executed from telnet client, it is returning correct
value 255.

This issue doesnt exist in any Unix 64 bit env.
Java version installed in 1.4.2.5_16

Pls advice

thanks
Anil
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Anil kumar P",
Please check your private messages.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Are you sure the problem is in your Java program? Try writing a short shell script that captures the return value and prints it (so there's no Java involved at all). Can you get values greater than 128?


"I'm not back." - Bill Harding, Twister
Anil kumar P
Greenhorn

Joined: Jan 16, 2008
Posts: 2
The shell script is returning value as 255 only.
But the java programme is returning as -1.

If the return value is less than 128, then java is also returning
correctly as 128.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Anil kumar P",

It is important that you follow the directions in your private messages.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Retun value of Runtime.exec in linux 32 bit