When I run my program in IntelliJ then use 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?
You can run a process with ⌃R (macOS), or Shift+F10 (Windows/Linux). To stop a process, you can use ⌘F2 on macOS, or Ctrl+F2 on Windows/Linux.
registerShutdownHook() method in Spring In Java programming language you can create shutdown hooks, where you create a new thread and provide logic that is executed when the JVM is shutting down. Then you can register your thread class instance as a shutdown hook to the VM using Runtime.
From the main menu, select Run | Show Running List. In the top-right corner of the editor, IntelliJ IDEA shows a list with all active applications.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With