Triggering a hook in NetBeans IDE

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

+3
source share
3 answers

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.

+3
source

. unix Windows , . . , siginit (ctrl c) . , NetBeans , . , .

, , ​​siginit sigterm. , ctrl c , files/sockets persistent/state. sigkill terminate, , sigkill .

NetBeans, IDE, .

+2

. , . docs...

, . , , , SIGKILL Unix TerminateProcess Microsoft Windows. , , , . , , - .

, , , .

0

All Articles