Patrickdev Patrickdev - 11 months ago 47
Java Question

Java applet doesn't fully refresh

I've been working on a game that's played in a java applet. It all works fine, until you try to refresh the page. It often seems to 'keep' the applet it used so far, and relaunches the game in the same applet. A new process is not created, and the ram usage shoots up (~250mb instead of ~140mb), and the same console is used for the applet. The drawing process is also quite laggy; it often skips about 0.5 seconds of frames before drawing again.

It only sometimes completely refreshes the applet; a new process is created (as seen in Windows' task manager), a new console opens, it uses less ram; it just starts from scratch again.

As I experience issues when it reuses the applet, I would like to force it to create the new process every time I refresh. Is there a way to do that? Or can I somehow fix the issues when it doesn't completely refresh?

The game I'm working on can be seen at Once it runs, press 'f' to toggle the fps and memory details.

Thank you in advance.

Answer Source

Applets support a parameter that force it to run the applet in a new jvm. This also works after refreshing the page, and is exactly what I was looking for - it starts from scratch. Just add this parameter to your applet tag:

<param name="separate_jvm" value="true" />

More information at