I am developing an application that will work as a service. I added shutdown to the program to do some file cleanup. When I install the program as a service (on Linux as a daemon or as a Windows service), the shutdown is done correctly. However, when starting in the IDE, the stop hook never executes. Is there a way to stop a running process in the IDE and execute a shutdown command?
Thanks Pablo
Unfortunately, there is no way to do this on the current Netbeans system, since the kill methods for both types of application testing (Debug and Normal) both kill the process well, giving it no way to clean it up. Depending on the architecture of your application, you may add a call to System.exit (0), but with the exception that you are stuck opening it in the console.
. unix Windows , . . , siginit (ctrl c) . , NetBeans , . , .
, , ββsiginit sigterm. , ctrl c , files/sockets persistent/state. sigkill terminate, , sigkill .
files/sockets
persistent/state
NetBeans, IDE, .
. , . docs...
, . , , , SIGKILL Unix TerminateProcess Microsoft Windows. , , , . , , - .
, , , .