windows 每个 Java 程序都会崩溃:无法创建 Java 虚拟机
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5183038/
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
Every Java program crashes with: Failed to create the java virtual machine
提问by Alessandro Dionisi
From yesterday I receive the message: "Failed to create the java virtual machine" in all Java applications in my Windows machine. Maybe I had a virus or something similar. The only advice I found on other sites is to set the heap size to a lower value. The problem is that I have big applications running that requires at least 1024M heap size. Also my machine has 4GB Ram so I think that it isn't a too low memory problem.
从昨天开始,我在 Windows 计算机的所有 Java 应用程序中收到消息:“无法创建 Java 虚拟机”。也许我感染了病毒或类似的东西。我在其他网站上找到的唯一建议是将堆大小设置为较低的值。问题是我运行的大型应用程序需要至少 1024M 的堆大小。另外我的机器有 4GB 内存,所以我认为这不是内存太低的问题。
回答by Stephen C
Carefully move the current JDK / JRE installation to one side, and install a fresh copy. If it works, you are done. If not, you have eliminated the possibility that this is a corrupted installation.
小心地将当前的 JDK / JRE 安装移到一侧,并安装一个全新的副本。如果它有效,你就完成了。否则,您就排除了安装已损坏的可能性。
Another possibility is that this is really a path problem. Can you run java -version
from a command prompt? Can you compile and run a Java "hello world" program from the command line?
另一种可能性是,这确实是一个路径问题。您可以java -version
从命令提示符运行吗?你能从命令行编译和运行 Java“hello world”程序吗?
Yes, in theory it could have had a virus ... or someone could have tinkered with the installation.
是的,理论上它可能有病毒……或者有人可能对安装进行了修补。
回答by Riggy
There are a few sites listing that error that differentiate between the heap and perm space. If you're running this through eclipse, try removing the default perm space value in the eclipse.ini: --launcher.XXMaxPermSize 256m
有几个站点列出了区分堆和永久空间的错误。如果您通过 eclipse 运行它,请尝试删除 eclipse.ini 中的默认永久空间值:--launcher.XXMaxPermSize 256m
回答by Jayan
Sun JVM needs contigous memory block. In windows this could a problem due to dll-rebasing. http://www.drdobbs.com/184416272;jsessionid=HJJRNPUURRDIZQE1GHPCKHWATMY32JVN
Sun JVM 需要连续的内存块。在 Windows 中,这可能是由于 dll-rebase 导致的问题。http://www.drdobbs.com/184416272;jsessionid=HJJRNPUURRDIZQE1GHPCKHWATMY32JVN
Is there any thing else changed?
有什么其他改变吗?
We got similar problem we installed some new applications(guess it was Citrix) on it. A tool we used was from here http://www.codeproject.com/KB/DLL/RebaseDLLs.aspx(download the code and modify)
我们遇到了类似的问题,我们在其上安装了一些新应用程序(猜测是 Citrix)。我们使用的一个工具来自这里http://www.codeproject.com/KB/DLL/RebaseDLLs.aspx(下载代码并修改)
If it is left to you, then consider moving to 64bit jvm.
如果它留给你,那么考虑转移到 64 位 jvm。
回答by Shishir
Same problem even i was facing when i first started eclipse.. Just change the value of "–launcher.XXMaxPermSize" in eclipse.ini file..
即使我第一次启动 eclipse 时也面临同样的问题.. 只需更改eclipse.ini 文件中“ –launcher.XXMaxPermSize”的值..
The eclipse.ini file should now look like this:
eclipse.ini 文件现在应如下所示:
-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
–launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503
-product
org.eclipse.epp.package.jee.product
–launcher.defaultAction
openFile
–launcher.XXMaxPermSize
–showsplash
org.eclipse.platform
–launcher.XXMaxPermSize
256m
–launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
回答by John Ashmore
It is because Eclipse cannot find the path of javaw.exe
是因为Eclipse找不到javaw.exe的路径
Just edit "eclipse.ini" file, adding this path:
只需编辑“eclipse.ini”文件,添加以下路径:
Open the file and attach following sentences (replacing with your own path if different): -vm C:\Program Files\Java\jdk1.7.0_03\bin\javaw.exe
打开文件并附上以下句子(如果不同,请替换为您自己的路径):-vm C:\Program Files\Java\jdk1.7.0_03\bin\javaw.exe
Sample:
样本:
-startup
-启动
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
插件/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810
插件/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810
-showsplash
-showsplash
org.eclipse.platform
org.eclipse.platform
--launcher.XXMaxPermSize
--launcher.XXMaxPermSize
256m
256m
--launcher.defaultAction
--launcher.defaultAction
openFile
打开文件
-vm C:\Program Files\Java\jdk1.7.0_03\bin\javaw.exe
-vm C:\Program Files\Java\jdk1.7.0_03\bin\javaw.exe
-vmargs
-vmargs
-Xms40m
-Xms40m
-Xmx384m
-Xmx384m
回答by SIslam
Changing the before file into:
将之前的文件更改为:
"-vm C:\Program Files\Java\jdk1.7.0_03\bin\javaw.exe"
solves the problem mentioned earlier
解决了前面提到的问题
回答by Alexis
First I had tried to make changes in eclipse.ini
file as there was told here, but that did not help.
首先,我曾尝试按照eclipse.ini
此处的说明对文件进行更改,但这并没有帮助。
I simply deleted this .ini
file, it helped and Eclipse launched.
我只是删除了这个.ini
文件,它帮助了 Eclipse 启动。
回答by Puce
Did you try to reinstall Java? Maybe also update to latest version.
您是否尝试重新安装 Java?也许也更新到最新版本。