This question has been asked before, but there is still no answer.
The scenario is that a Java command line program is started from a Windows console window. The program is still executed when the "X" close button of the console window is pressed.
The effect is that the programm is terminated without the shutdown hooks beeing executed (they are in place and react properly on Ctrl-C).
This answer to that question suggests that it is possible to do it from C.
Is there a (possibly platform specific) library that allows to react to the closing event and use the SetConsoleCtrlHandler from Java?