Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop a process running in IntelliJ such that it calls the shutdown hooks?

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?

like image 1000
James Avatar asked Jan 18 '11 18:01

James


People also ask

How do I stop a running process in IntelliJ?

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.

What is shutdown hook in spring?

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.

How do I run in IntelliJ?

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.


1 Answers

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:

Exit

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.

like image 169
CrazyCoder Avatar answered Oct 09 '22 02:10

CrazyCoder