I am trying to make an app in java that uses some c/c++ code in order to execute some code before computer shutdown,restart,hibernate,sleep or logoff. I was told in the java forum that I had to use c/c++ coding to do this. I was wondering if it would be enough to use the command runlevel in a terminal in my c/c++ app, and if that returns something, then I would send that to my java app, to do the rest. If this is not enough, could someone give me a suggestion as to how I could solve my problem?
Thanks.