简体   繁体   中英

Netbeans - Can a Java Application React to 'Stop'?

I've googled for quite some time now but I couldn't find any threads about if an application, started with Netbeans as 'Run' or 'Debug', is able to recognize if you 'Stop' it with Netbeans (clicking on the big red square at 'Outputs' or in the 'Debug' toolbar) and still is able to do some work, ie write a config before terminating.

I guess it can't because it probably just kills the JRE thread, but maybe I'm wrong and there is a chance to let the application do some work even if it gets shut down like this.

The stop kills the JVM. The JVM has no way to detect if it is killed thus there is no way to do something after that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM