How can I start an Java applet with more memory?

纵然是瞬间 提交于 2019-11-27 19:11:34

问题


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.


回答1:


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




回答2:


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




回答3:


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" /"



回答4:


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.




回答5:


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/




回答6:


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/




回答7:


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.



来源:https://stackoverflow.com/questions/102003/how-can-i-start-an-java-applet-with-more-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!