Is there a way for a Java GUI application to respond to system shutdown or logoff events, other than to use JNI? (On Windows, the JNI would use WM_QUERYENDSESSION, on Linux
You can schedule a Thread to be run on JVM shutdown - see addShutdownHook().