I use Windows.
I have a java application wrapped in an exe with launch4j. When I run it, I see two processes in my task manager: the exe wrapper, and the underlying java. When the program ends, both processes disappear.
When I run the exe with the command line, if I want to stop the process prematurely, I Ctrl-C, and both processes are terminated.
But in some cases, the program is run by another java application, with the process api. In this case, if the application must be stopped prematurely, I tried using myProcess.destroy(), but only the exe wrapper was stopped, the underlying java continued to run. I also tried destroyForcibly() with the same result.
Why the difference in behavior? How can I really emulate the behavior of Ctrl-C and kill both processes?