Skip to content
Advertisement

Applet: Java heap space

Due to a small implementation mistake I discovered how quickly I could reach a Java heap space issue

now the bug is fixed everything is fine but it did get me looking into how to solve this and I foudn multiple solution such as

java -Xms5m -Xmx15m MyApp

the problem is that this changes the java memory on my computer, but I’m working on a Applet that is going to be used in a webrowser.

Therefore, is there a way, at RUNTIME in an APPLET to change the heap size ?

Advertisement

Answer

You can add parameters to the applet tag. But the parameter you are interested on is available only on Java6 u10 or later.

Example:

<APPLET archive="my_applet.jar" code="MyApplet" width="300" height="300">
    <PARAM name="java_arguments" value="-Xmx256m">
</APPLET>

Here more information http://www.oracle.com/technetwork/java/javase/plugin2-142482.html#JAVA_ARGUMENTS

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement