Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Runtime.Exec with cmd and problem in waitFor

807569Jun 7 2006 — edited Jun 8 2006
Hi

I am running
Process p1 = Runtime.getRuntime().exec("cmd /c start /min <some.exe> <args to exe>");
then I am checking
Int ExitVal = p1.waitFor;
If (ExitVal != 0) and so on.

However, the problem is that the p1.waitFor does not really block the thread. It returns 0 and the program continues even though the some.exe has still not completed its execution.
My guess is that Java is giving the exitcode of cmd.exe and not some.exe.
If this analysis is correct, I am stumped. How do I get the exit code of some.exe?
If my analysis is wrong, please help me in the right direction.

Regards
Shreekar
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 6 2006
Added on Jun 7 2006
11 comments
917 views