How to get shutdown hook to execute on a process launched from Eclipse
I used the following hack at the end of my main method to get around the problem: if (Boolean.parseBoolean(System.getenv(“RUNNING_IN_ECLIPSE”))) { System.out.println(“You’re using Eclipse; click in this console and ” + “press ENTER to call System.exit() and run the shutdown routine.”); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } System.exit(0); }