Java applet was not killed while browsing

How to stop the Java applet process when the user navigates from the page from which the applet was loaded?

I use Chrome, and now, to kill the applet, I have to use the window taskbar and kill the java.exe process

+4
source share
1 answer

Java applets have life cycle methods. These are init , start , stop and destroy . You must learn how to use them, but more importantly, you must find out when the browser calls each of these methods.

When you go from your page, stop is called, and you must stop the threads that you started at start , and the cleanup resources if you allocated them. Browsers do not kill the JVM every time the page is reloaded, because it will be extremely inefficient (and for other reasons), so if you want to stop everything your applet does, inject it into the stop method.

Also see here and other links on this page for further explanation.

+7
source

Source: https://habr.com/ru/post/1415212/


All Articles