如何在Windows 7电脑上增加Java内存

下载PDF文件下载PDF文件

在电脑上运行Java应用程序会占据一部分内存,这部分内存又称为Java内存(堆内存)。为了防止内存有限而影响应用程序运行的性能,你需要设置Java参数,增加Java内存。这篇文章将介绍如何在Windows 7系统中增加Java内存。

  1. How.com.vn 中文: Step 1 打开控制面板。
    点击“开始”按钮,然后点击“控制面板”。
  2. How.com.vn 中文: Step 2 选择“程序”。
    在控制面板的左侧,点击“程序”。点击绿色字样的“程序”按钮,不是蓝色的“卸载程序”。
  3. How.com.vn 中文: Step 3 前往Java设置。
    在下一个对话框中点击“Java”,它通常位于其它程序的下面。接着会打开“Java控制面板”。
  4. How.com.vn 中文: Step 4 选择“Java”选项卡。
    在Java选项卡中,点击“浏览”按钮。打开“Java Runtime环境设置”。
  5. How.com.vn 中文: Step 5 更改堆内存配置。
    更改“Runtime 参数”一栏的数值。如果这一栏是空的,请添加新数值来设置Java内存。
  6. How.com.vn 中文: Step 6 修改参数。
    双击“Runtime 参数”一栏,
    • 输入-Xms512m - 会给Java分配512MB内存。
    • 输入-Xms1024m - 会给Java分配1GB内存。
    • 输入-Xms2048m - 会给Java分配2GB内存。
    • 输入-Xms3072m - 会给Java分配3GB内存。
    • 注意,输入的数值以减号开始,以字母m结束。
    • 注意,字符之间没有空格。
  7. How.com.vn 中文: Step 7 关闭对话框。
    点击“Java Runtime环境设置”窗口里的“确定”按钮,关闭对话框。
  8. How.com.vn 中文: Step 8 关闭Java对话框。
    点击“Java控制面板”里的“应用”按钮,确定新的内存空间,然后点击“确定”启用设置。
  9. How.com.vn 中文: Step 9 关闭控制面板窗口。
    广告

小提示

  • 如果Java无法找到足够的内存空间来调度,窗口中会弹出一条“异常”信息:“Exception in thread "main" java.lang.OutOfMemoryError: Java heap space”。
  • 这个方法同样适用于Windows 8系统。
  • 这里划出的内存空间是一块“临时”内存,当你运行Java程序时可以调度这一部分内存。但是它不会永久占用这部分电脑内存,只是临时调配给Java虚拟机,以保证它运行顺利。
  • 你选择的数值取决于电脑的内存空间和所有运行的程序所占用的空间大小。
  • 修改Java内存后,不需要重启计算机。
  • 这个方法稍作修改,也可以应用在Windows Xp系统上。
广告

关于本How.com.vn

How.com.vn是一个“多人协作写作系统”,因此我们的很多文章都是由多位作者共同创作的。 为了创作这篇文章,14位用户(部分匿名)多次对文章进行了编辑和改进。 这篇文章已经被读过5,272次。
分类: 计算机
本页面已经被访问过5,272次。

这篇文章对你有帮助吗?

⚠️ Disclaimer:

Content from Wiki How 中文 language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

Notices:
  • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
  • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
  • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
  • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

广告