如何启动具有更多内存的 Java 小程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/102003/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 08:18:43  来源:igfitidea点击:

How can I start an Java applet with more memory?

javamemoryappletnext-generation-plugin

提问by Horcrux7

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?

对于大型 Java 应用程序,默认的 64 MB 最大堆内存可能很小。是否有任何小程序参数可以为已签名的小程序增加它?

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

对于 Java 程序,这是一个简单的命令行参数,但它是如何用于浏览器中的小程序的。

采纳答案by jsight

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

JDK6u10 中新插件架构支持这一点。在此之前,唯一的方法是在 Java 控制面板中。

回答by Liedman

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.

显然,您可以从 Java 插件控制面板为浏览器的 JVM 设置 JVM 的堆大小,但这是用户在启动小程序之前必须做的事情。

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

您可以随时查看http://forums.sun.com/thread.jspa?threadID=523105&messageID=3033288以获取有关该主题的更多讨论。

回答by paul

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

使用 JavaConsole -> Java -> Java Applet Runtime 设置来定义初始和最大内存分配(使用 -Xms128 -Xmx512 或类似方法)。

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

我知道较新版本的 Java (6?) 允许开发人员对这些设置产生一些影响,但我还没有去过那里......

回答by Jason Kealey

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

实际上,在 Java Web Start (JNLP) 中启动小程序可以让您指定与传统 Java 应用程序相同的内存限制。(Xms 和 Xmx)。

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

JNLP 默认支持小程序,因此在大多数情况下不需要更改代码。

回答by Jason Kealey

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/

有可能通过在示例中设置参数来更改此值它工作自 java1.6.0_10 详细信息在https://jdk6.dev.java.net/plugin2/

回答by Mayur

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

将以下行添加到 JNLP 文件中的“资源”

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

回答by Nishant

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

i) 通过在 java 控制面板中增加 Xms、Xmx 和 Xmn 值以及 MaxPermSize java 参数;和/或

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

ii) 通过在 jsp/html 中向 OBJECT 标签添加 java_arguments PARAM 标签:

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

此链接对此有更多了解:http: //technoguider.com/2015/06/memory-requirements-for-an-applet/