HELP! How to know when a Runtime-invoked JVM has finished with it's class? HELP!
Posted on 2005-05-13
(This is a follow-up...)
I am trying to use Runtime to invoke another class, using an independent-process javaw.exe. However, when the called class finishes (either normally or abnormally), the called JVM continues to run. Meanwhile, my calling class is waiting for the called class to finish, but it doesn't know it's finished, because the called JVM continues to run. Is there any way for me to know when the called class is finished?
This from the calling class:
Runtime r = Runtime.getRuntime();
Process p = null;
p = r.exec("javaw.exe MyCalledClass");
System.out.Println("Called class died"); // IT NEVER GETS HERE
and this is from the called class:
and I have tried:
int x = 1;
int y = 0;
x = x / y;
I don't want to implement runnable at this point. I want two separate JVM's running.
Any help would be greatly appreciated.