How can I run code when the JRE is shutting down?
Created May 4, 2012
Davanum Srinivas In JDK 1.3 you can use the following snippet:
Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { // Your code goes here. } });For more information, look at Sun's Design of the Shutdown Hooks document.