Troubles with Class "Process" and "Runtime"

Hi everyone,

I have a little problem developing an Interface that use and launch some external processes (e.g. like compiled .exe files).

I always used this code:

String command1 ="HC.exe -o options";

String command2 ="HV.exe -c config";

Runtime run_machine = Runtime.getRuntime();

Process p1 = run_machine.exec(command1);

p1.waitFor();

Process p2 = run_machine.exec(command2);

p2.waitFor();

I didn't posted exception handling because i want to talk about the core problem.

Well it always worked fine because I need to run a process then wait for it and then use files generated by p1 in process p2, then wait again and then continue...

Ok now I changed some HV.exe's option and now this solution doesn't work anymore. The problem seems to be that p2 wait for my current Thread... that is waiting for p2... so loop everyone waiting for everyone... more... if i force closing my java program, HV.exe launched from p2 complete his work and give output...

well i have no idea about how i can solve this trouble. I'm thinking about a solution that make HV process that it was not launched by my java program... but how can i do this?

Thank you all

[1291 byte] By [charlengera] at [2007-11-26 18:17:38]
# 1

Ok solved... it was a stupid problem... my HV.exe tried to get control of command line (:S) but cannot because it was under java virtual machine control (:/). Changing my program HV.exe options i made it work.

But i have a little question... how can i release some resources (like command line control) from java making other processes run correctly?

thank you

charlengera at 2007-7-9 5:51:15 > top of Java-index,Java Essentials,Java Programming...