10

我已经访问了与我的问题相关的所有现有问题,但我仍然有问题。所有安装均已正确安装。我正在使用最新的 Netbeans 版本。执行程序后出现此错误:

Error: Could not create the Java Virtual Machine.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: A fatal exception has occurred. Program will exit.

我的 Netbeans.conf 是:

# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/7.1.2"
# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
netbeans_default_options="-J-client -J-Xss2m -J-Xms16m -J-XX:PermSize=16m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true"
# Note that default -Xmx and -XX:MaxPermSize are selected for you automatically.
# You can find these values in var/log/messages.log file in your userdir.
# The automatically selected value can be overridden by specifying -J-Xmx or
# -J-XX:MaxPermSize= here or on the command line.
# If you specify the heap size (-Xmx) explicitly, you may also want to enable
# Concurrent Mark & Sweep garbage collector. In such case add the following
# options to the netbeans_default_options:
# -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled J-XX:+CMSPermGenSweepingEnabled
# (see http://wiki.netbeans.org/FaqGCPauses)
# Default location of JDK, can be overridden by using --jdkhome <dir>:
netbeans_jdkhome="C:\Arquivos de programas\Java\jdk1.7.0_07"
# Additional module clusters, using ${path.separator} (';' on Windows or ':' on Unix):
#netbeans_extraclusters="/absolute/path/to/cluster1:/absolute/path/to/cluster2"
# If you have some problems with detect of proxy settings, you may want to enable
# detect the proxy settings provided by JDK5 or higher.
# In such case add -J-Djava.net.useSystemProxies=true to the netbeans_default_options.

我需要做什么?我整天都在尝试解决这个错误。我的系统内存是 3Gb。

4

4 回答 4

4

我在启动时遇到了同样的错误Netbeans

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

我尝试重新启动Netbeans很多次。重复同样的错误。后来我发现它正在发生,因为其他一些应用程序已经在使用JVM. 所以我找了一个这样的应用程序Tomcat Server。我终止Tomcat并尝试Netbeans重新开始,这很好。因此,请尝试寻找任何使用JVM.

于 2013-09-24T02:51:24.633 回答
4

无法为对象堆保留足够的空间

这几乎总是意味着你-Xmx对机器来说太高了。上面有一条消息:

# 注意默认的 -Xmx 和 -XX:MaxPermSize 会自动为你选择

尝试提供明确的价值,从小处着手。请注意,-Xms必须小于或等于-Xmx

于 2012-10-09T21:52:12.000 回答
2

对于上述问题,我们有几个解决方案

解决方案 1:您可以重新安装所有组件。即这意味着您已经安装了整个软件。对于错误:无法创建 Java 虚拟机。

解决方案 2:最大堆大小取决于机器架构,例如 32 位或 64 位,JVM 位大小,例如 32 位 JVM 或 64 位 JVM 和操作系统。

在 32 位机器中,虽然最大堆大小的理论限制为 4GB,但它因操作系统而异,例如在 32 位 Windows XP 上,由于各种原因,最大堆大小限制为 1.5G,而在 64 位 Solaris 机器上,即使使用 32 位 JVM你可以负担得起大约 3.5GB。因此,当您在 32 位 Windows XP 机器上运行以下 java 命令时

解决方案 3:在提供堆空间时,另一个值得注意的语法错误是数字文字和单元之间的空间,如下例所示:

Correct: ~/java java -Xmx1500 M
In-correct:   ~/java java -Xmx1500MB
In-Correct:  ~/java java -Xmx 1400M 
于 2013-04-12T10:13:10.320 回答
1

-J-Xss2m -J-Xms16m -J-XX:PermSize=16m

这些是不够的价值。尝试从 16Mb 增加到 512Mb(或 1Gb)

于 2012-10-09T21:37:15.577 回答