Duplicate :
|
When running external projects via Runtime.exec() method on Unixes, sometimes it cannot be terminated via Process.destroy() method. I was looking at the sources of JVM and discovered, that destroy() method delegates to JNI call, which then call kill() system call, but uses SIGTERM as signal. This unfortunately does not have to kill the process, so there is actually no way how to guarantee the spawned process can be terminated uncoditionaly. So I suggest to either to change signal to SIGKILL or to define several levels of destroying process in Java, in which the highest level would send SIGKILL, the lower SIGTERM, etc ...