Eclipse 错误:“无法创建 Java 虚拟机”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7302604/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:30:10  来源:igfitidea点击:

Eclipse error: 'Failed to create the Java Virtual Machine'

eclipsejvm

提问by Maro

I am getting this error message when I start Eclipse Helios on Windows 7:

我在 Windows 7 上启动 Eclipse Helios 时收到此错误消息:

Failed to create the Java Virtual Machine

未能创建 Java 虚拟机

Enter image description here

在此处输入图片说明

My eclipse.ini looks as follows:

我的 eclipse.ini 如下所示:

-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
-vm
P:\Programs\jdk1.6\bin
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms120m
-Xmn100m
-Xmx1024m

My JAVA_HOME is correctly set as far as I can tell. How can I fix this?

据我所知,我的 JAVA_HOME 设置正确。我怎样才能解决这个问题?

Things I have tried so far:

到目前为止我尝试过的事情:

  1. Adding the full path to javaw.exe -vm P:\Programs\jdk1.6\bin\\bin\javaw.exe
  2. Removing the -vmoption altogether
  3. Removing --launcher.XXMaxPermSizefixes the issue, but it causes permgen errors
  4. Removing the value 512of --launcher.XXMaxPermSizefixes the issue, but it causes permgen errors
  5. Reducing -Xmxto 512malso fixes the issue.
  1. 将完整路径添加到 javaw.exe -vm P:\Programs\jdk1.6\bin\\bin\javaw.exe
  2. -vm完全删除选项
  3. 删除--launcher.XXMaxPermSize修复了问题,但会导致 permgen 错误
  4. 卸下值512--launcher.XXMaxPermSize修复问题,但它会导致PermGen的错误
  5. 减少-Xmx512m也解决了这个问题。

Why can I not use '1024m' for '-Xmx' and '--launcher.XXMaxPermSize'?

为什么我不能将“1024m”用于“-Xmx”和“--launcher.XXMaxPermSize”?

采纳答案by Matt Ball

Try removing the -vm P:\Programs\jdk1.6\binlines.

尝试删除-vm P:\Programs\jdk1.6\bin线条。



Also, a general recommendation: set -Dosgi.requiredJavaVersion=1.6, not 1.5.

另外,一般建议: set -Dosgi.requiredJavaVersion=1.6, not 1.5

回答by Akhil Jain

1.Open the eclipse.inifile from your eclipse folder,see the picture below.

1.eclipse.ini从你的 eclipse 文件夹中打开文件,见下图。

eclipse.ini

eclipse.ini

2.Open eclipse.iniin Notepador any other text-editorapplication, Find the line -Xmx256m(or -Xmx1024m). Now change the default value 256m(or 1024m) to 512m. You also need to give the exact java installed version (1.6 or 1.7 or other).

2.eclipse.iniNotepad或任何其他text-editor应用程序中 打开,找到该行-Xmx256m(或-Xmx1024m)。现在将默认值256m(或1024m)更改为512m。您还需要提供确切的 java 安装版本(1.6 或 1.7 或其他)。

max size

max size

Like This:

像这样:

-Xmx512m
-Dosgi.requiredJavaVersion=1.6

OR

或者

-Xmx512m
-Dosgi.requiredJavaVersion=1.7

OR

或者

-Xmx512m
-Dosgi.requiredJavaVersion=1.8

Then it works well for me.

然后它对我来说效果很好。

回答by RonQi

Try to add

尝试添加

-vm
D:\Java\jdk1.6.0_29\bin\javaw.exe

FYI: Refer sunblog

仅供参考:参考sunblog

For others who might have problems with Java 7, as per Eclipse Wiki - eclipse.ini vm_value (windows example)

对于可能对 Java 7 有问题的其他人,根据Eclipse Wiki - eclipse.ini vm_value(windows 示例)

This might not work on all systems. If you encounter "Java was started but returned exit code=1" error while starting the eclipse, modify the -vm argument to point to jvm.dll

这可能不适用于所有系统。如果在启动 eclipse 时遇到“Java was started but returned exit code=1”错误,请修改 -vm 参数以指向 jvm.dll

e.g.

例如

-vm
C:\Program Files\Java\jre7\bin\client\jvm.dll

Also note that

还要注意的是

The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM

-vm 选项必须出现在 -vmargs 选项之前,因为 -vmargs 之后的所有内容都直接传递给 JVM

回答by Popeye

I know this is pretty old now but I have just had the same issue and the problem was I was allocating to much memory to eclipse that it could not get hold of. So open eclipse.ini and lower the amount of memory that is being allocated to -XmxXXMaxPermSizeI changed mine to -Xmx512mand XXMaxPermSize256m

我知道这现在已经很老了,但我刚刚遇到了同样的问题,问题是我为 eclipse 分配了很多内存,但它无法掌握。因此,打开 eclipse.ini 并降低分配给-XmxXXMaxPermSize我的内存量,我将其更改为-Xmx512mXXMaxPermSize256m

回答by Furqi

  1. Open the eclipse.inifile from your eclipse folder.

  2. It has some of add on configuration . Find the line –launcher.XXMaxPermSize. Now remove the the default value 256m and save it.

  1. eclipse.ini从 eclipse 文件夹中打开该文件。

  2. 它有一些附加配置。找到线–launcher.XXMaxPermSize。现在删除默认值 256m 并保存它。

回答by Monnster

I removed eclipse.ini. I encountered this issue and removing the inifile solved it.

我删除了eclipse.ini。我遇到了这个问题,删除ini文件解决了它。

回答by A Garhy

  1. Open folder with Eclipse.exe and find eclipse.ini file
  2. Replace -vmargsby your current real path of javaw.exe: *-vm “c:\Program Files\Java\jdk1.7.0_07\bin\javaw.exe”*

    -startup
    plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
    --launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
    -product
    com.android.ide.eclipse.adt.package.product
    --launcher.XXMaxPermSize
    256M
    -showsplash
    com.android.ide.eclipse.adt.package.product
    --launcher.XXMaxPermSize
    256m
    --launcher.defaultAction
    openFile
    **-vm “c:\Program Files\Java\jdk1.7.0_07\bin\javaw.exe”** 
    -Dosgi.requiredJavaVersion=1.6
    -Xms40m
    -Xmx768m
    -Declipse.buildId=v21.1.0-569685
    
  1. 用 Eclipse.exe 打开文件夹并找到 eclipse.ini 文件
  2. -vmargs替换为您当前的 javaw.exe 真实路径:*-vm “c:\Program Files\Java\jdk1.7.0_07\bin\javaw.exe”*

    -startup
    plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
    --launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
    -product
    com.android.ide.eclipse.adt.package.product
    --launcher.XXMaxPermSize
    256M
    -showsplash
    com.android.ide.eclipse.adt.package.product
    --launcher.XXMaxPermSize
    256m
    --launcher.defaultAction
    openFile
    **-vm “c:\Program Files\Java\jdk1.7.0_07\bin\javaw.exe”** 
    -Dosgi.requiredJavaVersion=1.6
    -Xms40m
    -Xmx768m
    -Declipse.buildId=v21.1.0-569685
    

回答by user3739970

I found a very easy solution for this. Just delete eclipse.inifile, but backup first. I had this same problem many times and finally I deleted this and I no more have the problem.

我为此找到了一个非常简单的解决方案。只是删除eclipse.ini文件,但先备份。我多次遇到同样的问题,最后我删除了这个,我不再有问题了。

It also increased loading time. Now my Eclipse starts faster than earlier.

它还增加了加载时间。现在我的 Eclipse 启动速度比以前更快。

回答by Yasir Ali

You can also solve this issue by removing the value "256m" under the line "-launcher.XXMaxPermSize”.

您还可以通过删除“-launcher.XXMaxPermSize”行下的值“256m”来解决此问题。

回答by rajachinnappan

In STS.conffile you need to check two important things to avoid create/allocate jvm issue

STS.conf文件中,您需要检查两件重要的事情以避免创建/分配 jvm 问题

1.Give the exact jdk install location:

1.给出确切的jdk安装位置:

--vm C:\Program Files\Java\jdk1.7.0_01\jre\bin\javaw.exe

2.You need to give the exact java installed version:

2.您需要提供确切的java安装版本:

--Dosgi.requiredJavaVersion=1.7

3.Try to reduce the memory size:

3.尽量减少内存大小:

--XX:MaxPermSize=256m