Is there some way to execute some piece of code before the computer shutsdown, logs off, hibernates or sleeps, with java?
I tried to use runlevel in a terminal in lubuntu, to try and listen for a 0, and if that happened, execute the code, but that did not work.
I also tried executing a joptionpane in shutdown, by listening for app exit, but that also did not work.
Can someone give me another advice?
Thanks.