Is it possible for Eclipse to terminate gently instead of using SIGKILL?

I looked at How can a Java program get its own process ID? and came up with this.

System.out.println("kill -SIGINT "+ProcessHandle.current().pid());

I realize this isn't ideal if you don't want it printing this out for production but if you're just prototyping it's handy. Or you could put it inside an if that only runs if you're debugging.


Eclipse uses the Java Process API which sends the signal. This is a native API and there is no way to change that. I assume that you've tried to install a handler for SIGKILL, too, and that didn't work.

Therefore, the only solution would be to write a small batch file which lists the processes and sends SIGTERM to one of them. Invoke that from a command prompt. If you use Alt-Tab to switch to it, it's almost as comfortable as doing it from inside Eclipse.

Or write a plugin to invoke batch files.