VM 初始化过程中发生错误 无法为对象堆保留足够的空间 无法创建 Java 虚拟机
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20307923/
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
Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine
提问by user2694812
I am facing this problem since more than a month, here is what I see when I run java on command line:
一个多月以来我一直面临这个问题,这是我在命令行上运行 java 时看到的:
$ java -Xmx1300m
Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.
If I run with less memory it works fine
如果我以较少的内存运行它就可以正常工作
$ java -Xmx1240m Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) ..... .....
I spent a week trying to debug this and nothing worked. Finally I had my IT support guys replace the laptop. This happened a month ago on 10/23. Now, after a month, the same problem is back on my new system.
我花了一个星期试图调试它,但没有任何效果。最后我让我的 IT 支持人员更换了笔记本电脑。这发生在一个月前的 10/23。现在,一个月后,同样的问题又出现在我的新系统上。
My system configuration is:
我的系统配置是:
Win 7 Enterprise (64-bit), Service Pack 1. Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz 8.00 GB RAM
Win 7 Enterprise(64 位),Service Pack 1。Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz 8.00 GB RAM
Java: java version "1.5.0_20" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02) Java HotSpot(TM) Client VM (build 1.5.0_20-b02, mixed mode)
We are a team of about 30 guys here and I am the only one facing this. All others have almost the same config and working fine for them.
我们是一支大约 30 人的团队,我是唯一一个面临这种情况的人。所有其他人都有几乎相同的配置并且对他们来说工作正常。
An important observation is Java works fine for some time and then this problem appears once it appears it doesn't go away, even if I re-install java.
一个重要的观察结果是 Java 可以正常工作一段时间,然后这个问题一旦出现就出现了,即使我重新安装了 java。
I faced this issue the 3rd time after the IT support guys re-imaged by laptop. It worked for a month and now the same problem is back.
在 IT 支持人员通过笔记本电脑重新成像后,我第三次遇到了这个问题。它工作了一个月,现在同样的问题又回来了。
Everybody is completely clueless. I have started using 2 laptops now. :-)
每个人都完全没有头绪。我现在已经开始使用 2 台笔记本电脑了。:-)
回答by user2694812
Eureka ! Finally I found a solution on this.
尤里卡!最后我找到了解决方案。
This is caused by Windows update that stops any 32-bit processes from consuming more than 1200 MB on a 64-bit machine. The only way you can repair this is by using the System Restore option on Win 7.
这是由阻止任何 32 位进程在 64 位计算机上消耗超过 1200 MB 的 Windows 更新引起的。修复此问题的唯一方法是使用 Win 7 上的系统还原选项。
Start >> All Programs >> Accessories >> System Tools >> System Restore.
开始>>所有程序>>附件>>系统工具>>系统还原。
And then restore to a date on which your Java worked fine. This worked for me. What is surprising here is Windows still pushes system updates under the name of "Critical Updates" even when you disable all windows updates. ^&%)#* Windows :-)
然后恢复到您的 Java 工作正常的日期。这对我有用。令人惊讶的是,即使您禁用了所有 Windows 更新,Windows 仍会以“关键更新”的名义推送系统更新。^& %)#* 视窗 :-)
回答by Abhijeet
This might also occur if you are running on 64-bit Machine with 32-bit JVM (JDK), switch it to 64-bit JVM. Check your (Right Click on My Computer --> Properties) Control Panel\System and Security\System --> Advanced System Settings -->Advanced Tab--> Environment Variables --> JAVA_HOME...
如果您在具有 32 位 JVM (JDK) 的 64 位机器上运行,也可能会发生这种情况,请将其切换到 64 位 JVM。检查您的(右键单击我的电脑--> 属性)控制面板\系统和安全\系统--> 高级系统设置--> 高级选项卡--> 环境变量--> JAVA_HOME...
回答by user1651518
Thanks.I changed heap space from 2000MB to 1024MB and it worked...
谢谢。我将堆空间从 2000MB 更改为 1024MB 并且它起作用了...
回答by cbyte
回答by J. Titor
I've just seen this problem myself, Jboss AS7 with jdk1.5.0_09. Update System Property JAVA_HOME to jdk1.7+ to fix (I'm using jdk1.7.0_67).
我自己刚刚看到这个问题,Jboss AS7 with jdk1.5.0_09。将系统属性 JAVA_HOME 更新为 jdk1.7+ 以进行修复(我使用的是 jdk1.7.0_67)。
回答by user3554053
Sometimes it may happen that you run multiple applications on the same java VM. In Case you have tried all the other solutions described above and it didnt work. Try Running your process by running it on a newly created java VM by passing vmargs
有时可能会在同一个 Java VM 上运行多个应用程序。如果您已经尝试了上述所有其他解决方案,但没有奏效。尝试通过传递 vmargs 在新创建的 java VM 上运行您的进程
-agentlib:jdwp=transport=dt_socket,server=y,address=10049,suspend=n .
Here address is what the vm takes.
这里的地址是 vm 需要的。
回答by JediSal
If your computer is a 64bit, all you need to do is uninstall your Java x86 version and install a 64bit version. I had the same problem and this worked. Nothing further needs to be done.
如果您的计算机是 64 位,您需要做的就是卸载 Java x86 版本并安装 64 位版本。我有同样的问题,这奏效了。无需进一步操作。
回答by Ashish Katiyar
you can do update the User path as inside _JAVA_OPTIONS : -Xmx512M Path : C:\Program Files (x86)\Java\jdk1.8.0_231\bin;C:\Program Files(x86)\Java\jdk1.8.0_231\jre\bin for now it is working / /
您可以在 _JAVA_OPTIONS 中更新用户路径:-Xmx512M 路径:C:\Program Files (x86)\Java\jdk1.8.0_231\bin;C:\Program Files(x86)\Java\jdk1.8.0_231\jre \bin 现在它正在工作 //