Is it possible make some handler that will do something when user shutdown computer with Java on Windows XP (optional, win7)? How?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is possible to add a shutdown hook to your Java program which is invoked if the JVM is shutdown for any reason
(other thanincluding O/S shutdown. Is that what you want?System.exit())Use:
java.lang.Runtime.addShutdownHook(Thread):