views:

3033

answers:

5

The default 64 MB max heap memory can be small for a large Java application. Are there any applet parameter to increment this for a signed applet?

For a Java program this is a simple command line parameter but how this work for an applet in the browser.

A: 

Not that I know for certain, it's been a long time since I wrote applets, but I don't think you can set this from the applet.

Apparently, you can set the JVM's heap size for the browser's JVM from the Java plug-in control panel, but that's something the user has to do before starting your applet.

You can always check http://forums.sun.com/thread.jspa?threadID=523105&messageID=3033288 for more discussion on the topic.

Liedman
+4  A: 

Use the JavaConsole -> Java -> Java Applet Runtime settings to define the initial and maximum memory allocation (using -Xms128 -Xmx512 or similar).

I understand that newer versions of Java (6?) allow the developer some influence over these settings but I haven't been there yet...

paul
+5  A: 

The new plugin architecture in JDK6u10 supports this, but obviously thats only at the RC stage right now. Prior to that, the only way to do it was in the Java control panel.

jsight
"The new plugin architecture in JDK6u10 supports this, but obviously thats only at the RC stage right now."It's out now. :)
hishadow
+1  A: 

Actually, starting the applet inside Java Web Start (JNLP) lets you specify the same memory constraints that you would for a conventional Java application. (Xms and Xmx).

JNLP supports applets by default, so no code changes are required in most cases.

Jason Kealey
The problem with JNLP is that you can not start the application embedded in the html page.
Horcrux7
+1  A: 

There is possibility to change this value, by setting paramether in example It works since java1.6.0_10 details at https://jdk6.dev.java.net/plugin2/

Marcin Kilar