2
Currently I have a program JAVA(main), which from it calls another program JAVA (son)... this is OK.. but when I close the main program, I also want to close the son program.
I’ve tried to:
Runtime.getRuntime().exec("taskkill /F /PID **NOMEDOPROGRAMA**");
But it didn’t work...
The
taskkill /PID
awaits thepid
of the program, not its name. You could use/IM
to pass the name, but the problem is that the name of the program in the case of java programs is always java.exe (or javaw.exe). You will end up killing the son and the father together. How are you doing to launch the son process?– C. E. Gesser
Ah I managed to solve... I was calling the jar by the Runtime itself!
– peterq