How do I stop the process of a Java Applet when a user navigates away from the page the applet has been loaded from?
I am using Chrome, and for now to kill the applet, I have to use window’s taskbar and kill the process java.exe
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.
Java applets have lifecycle methods. Those are
init,start,stopanddestroy. You should learn to use them, but what’s more important, you should learn when a browser calls each of this method.When you navigate away from your page,
stopis called and you should stop threads you started instartand cleanup resources if you allocated any. Browsers do not kill JVM on every page reload because it would by extremely inefficient (and for other reasons), so if you want to stop whatever your applet is doing, implement it instopmethod.Also see here and other links on that page, for further explanation.