VM初始化过程中出现错误,无法为对象堆预留足够的空间,无法创建Java虚拟机

时间:2021-12-27 05:50:36

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.8 ghz 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. :-)

每个人都完全无能。我现在开始用两台笔记本电脑。:-)

7 个解决方案

#1


13  

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.

这是由Windows update导致的,它阻止任何32位进程在64位机器上消耗超过1200 MB。你能修复的唯一方法是使用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更新。^ # * & %)Windows:-)

#2


11  

Anyway, here is how to fix it:

不管怎样,这是如何修复的:

Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System Variables->New:

启动->控制面板->系统->高级(tab)->环境变量->系统变量->新:

Variable name: _JAVA_OPTIONS

变量名:_JAVA_OPTIONS

Variable value: -Xmx512M

变量值:-Xmx512M

taken from this link

从这个链接

#3


6  

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…

#4


3  

Thanks.I changed heap space from 2000MB to 1024MB and it worked...

谢谢。我将堆空间从2000MB更改为1024MB,它工作了……

#5


0  

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和jdk1.5.0_09。更新系统属性JAVA_HOME到jdk1.7+以进行修复(我使用的是jdk1.7.0_67)。

#6


0  

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位版本。我遇到了同样的问题,这很管用。没有什么需要做的了。

#7


-1  

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的地址。

#1


13  

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.

这是由Windows update导致的,它阻止任何32位进程在64位机器上消耗超过1200 MB。你能修复的唯一方法是使用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更新。^ # * & %)Windows:-)

#2


11  

Anyway, here is how to fix it:

不管怎样,这是如何修复的:

Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System Variables->New:

启动->控制面板->系统->高级(tab)->环境变量->系统变量->新:

Variable name: _JAVA_OPTIONS

变量名:_JAVA_OPTIONS

Variable value: -Xmx512M

变量值:-Xmx512M

taken from this link

从这个链接

#3


6  

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…

#4


3  

Thanks.I changed heap space from 2000MB to 1024MB and it worked...

谢谢。我将堆空间从2000MB更改为1024MB,它工作了……

#5


0  

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和jdk1.5.0_09。更新系统属性JAVA_HOME到jdk1.7+以进行修复(我使用的是jdk1.7.0_67)。

#6


0  

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位版本。我遇到了同样的问题,这很管用。没有什么需要做的了。

#7


-1  

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的地址。