class ExampleShutdownHook { public static void main(String[] args) { // Java code to install shutdown hook: MyShutdown MyShutdown sh = new MyShutdown(); Runtime.getRuntime().addShutdownHook(sh); // Do the Joone stuff // . // . // . } } // Example shutdown hook class class MyShutdown extends Thread { public void run() { System.out.println("MyShutdown hook called"); // Dump the shutdown file // . // . // . } }