[ACCEPTED]-Running code on program exit in Java-system.exit
Shutdown hooks are the answer... here is an article on them. They 2 do not come without issues (some of them 1 are discussed in the article).
You can use a shutdown hook.
http://download.oracle.com/javase/6/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)
Note that shutdown 2 hooks will not run if the VM aborts abnormally 1 or Runtime.halt(int) is called.
Look into shutdown hooks, see http://docs.oracle.com/javase/8/docs/technotes/guides/lang/hook-design.html
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.