Horcrux7
Horcrux7

Reputation: 24447

How can I start an Java applet with more memory?

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.

Upvotes: 13

Views: 23815

Answers (7)

Nishant
Nishant

Reputation: 1

It can be done through a couple of ways:

i) By either increasing the Xms, Xmx and Xmn values along with MaxPermSize java arguments in java control panel; and/or

ii) by adding a java_arguments PARAM tag to OBJECT tag in jsp/html:

This link throws more light on this: http://technoguider.com/2015/06/memory-requirements-for-an-applet/

Upvotes: -1

jsight
jsight

Reputation: 28409

The new plugin architecture in JDK6u10 supports this. Prior to that, the only way to do it was in the Java control panel.

Upvotes: 10

Mayur
Mayur

Reputation: 21

Add to the JNLP file the below lines in "resources"

j2se version="1.6+" initial-heap-size="256m" max-heap-size="1024m"
    href="http://java.sun.com/products/autodl/j2se" /"

Upvotes: 2

Marcin Kilar
Marcin Kilar

Reputation:

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/

Upvotes: 1

Jason Kealey
Jason Kealey

Reputation: 7986

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.

Upvotes: 1

paul
paul

Reputation: 13516

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...

Upvotes: 5

Liedman
Liedman

Reputation: 10329

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.

Upvotes: -3

Related Questions