Originally posted by Stuart Houston:
I have a program which starts 2 threads. Each of these threads then starts an external batch file which runs a executable program.
The problem is that when the original program is killed the 2 threads do not stop and the executables carry on running
how can i stop the executables from running once the original program has been stopped?
What you are saying does not make sense. If your original program is killed, then everything about it, including the JVM, exits. This includes any threads that were created to run in the JVM.
Now for the two external programs that were started. It really depends on your OS. For example, under unix, the ownership of the program will be passed to process 1, which will reap any exit conditions, when those program exits.
You have two choices. Have your program return information to your "killer" about the two programs, such as PID, so they too, can be killed. Or arrange somekind of indication for them to know that your program was killed, so they too, will exit.
Henry
[ November 05, 2004: Message edited by: Henry Wong ]