在Windows中设置默认堆大小 [英] Set default heap size in Windows

查看:880
本文介绍了在Windows中设置默认堆大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想永久设置Java堆大小,并且不希望使用选项运行每个jar文件。
我使用Windows和Java 1.7。

I want to set Java heap size permanently and don't want to run every jar file with options. I use Windows and Java 1.7.

推荐答案

JAVA_OPTS 设置为系统变量以下内容:

Setup JAVA_OPTS as a system variable with the following content:

JAVA_OPTS = - Xms256m -Xmx512m

之后在命令提示符下运行以下命令:

After that in a command prompt run the following commands:

SET JAVA_OPTS="-Xms256m -Xmx512m"

这可以解释如下:


  • 分配至少256MB的堆

  • 分配最多512MB的堆

这些值应根据应用要求进行更改。

These values should be changed according to application requirements.

编辑:

您也可以尝试添加它通过环境属性菜单,可在以下位置找到:

You can also try adding it through the Environment Properties menu which can be found at:


  1. 桌面,右键单击我的电脑,然后点击属性

  2. 点击左栏中的高级系统设置链接。

  3. 系统属性窗口中,单击环境变量按钮。

  4. 单击新建到添加新变量名称和值。

  5. 对于变量名称,输入 JAVA_OPTS 作为变量值输入 -Xms256m -Xmx512m

  6. 单击确定并关闭系统属性选项卡。

  7. 重新启动任何Java应用程序。

  1. From the Desktop, right-click My Computer and click Properties.
  2. Click Advanced System Settings link in the left column.
  3. In the System Properties window click the Environment Variables button.
  4. Click New to add a new variable name and value.
  5. For variable name enter JAVA_OPTS for variable value enter -Xms256m -Xmx512m
  6. Click ok and close the System Properties Tab.
  7. Restart any java applications.

编辑2:

JAVA_OPTS 是一个系统变量,可存储各种设置/配置本地 Java虚拟机。通过将 JAVA_OPTS 设置为系统变量,在 JVM 之上运行的所有应用程序都将从此参数中获取其设置。

JAVA_OPTS is a system variable that stores various settings/configurations for your local Java Virtual Machine. By having JAVA_OPTS set as a system variable all applications running on top of the JVM will take their settings from this parameter.

要设置系统变量,您必须完成上面列出的步骤1到4。

To setup a system variable you have to complete the steps listed above from 1 to 4.

这篇关于在Windows中设置默认堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆