How do I stop a processing running in intelliJ suc

2019-01-11 16:03发布

问题:

When I run my program in intelliJ then using the STOP button it does not call my shutdown hooks that I've created. Is there a way in intelliJ to have those called on shutdown?

thanks

回答1:

You need to use the Exit button in the Run panel, not the Stop button. Note that it will only work when Running and will not work when Debugging.

Here is the screenshot if you can't find it:

This feature uses platform specific code and currently works on Windows and Linux only. Once IDEA-56273 is fixed, this feature should be also available on Mac. It is fixed in 10.5 version of IDEA.



回答2:

If you are on Mac (and I assume Linux), get the pid and use kill from the terminal. It's an extra step, but works to debug the shutdown handler when you need to.