如何修复 Eclipse Java 虚拟机启动器错误?

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

How to fix Eclipse Java Virtual Machine Launcher Error?

javaeclipsejvmruntime-errorjvm-crash

提问by Ashwin Gupta

So like the title says, Im having an issue with eclipse JVM launcher. Last night, everything was working fine, as far as I know, nothing at all has changed on my pc since then. However, I woke up this morning to find that when I run any of my projects in eclipse I recive this error: Java Virtual Machine Launcher- Error: could not open C:\Program Files\Java\jre1.8.0_60\lib\amd6jvm.cfg

所以就像标题所说的那样,我遇到了 Eclipse JVM 启动器的问题。昨晚,一切正常,据我所知,从那以后我的电脑上没有任何变化。然而,我今天早上醒来发现当我在 eclipse 中运行我的任何项目时,我收到了这个错误:Java Virtual Machine Launcher- Error: could not open C:\Program Files\Java\jre1.8.0_60\lib\amd6jvm.cfg

I have already verified the integrity of my Pathvariable, (C:\Program Files\Java\jdk1.8.0_65\bin) Now at this point, you may notice, my jdk is on version 65. So is my JRE and java installation. I dont understand why eclipse is using jre 60. I also checked the preferences and changed the jre version too 65. No luck. Furthermore, I ran a simple java file without using eclipse through the command line and that ran/compiled just fine. I tried adding the -vm tag (It didn't already exist there) to eclipse.ini and setting it too the jvm but it didn't help. (I than removed it) I have no idea what to do... Please help, I've tried everything I know how to do. Thanks!

我已经验证了我的Path变量的完整性, ( C:\Program Files\Java\jdk1.8.0_65\bin) 现在,您可能会注意到,我的 jdk 版本为 65。我的 JRE 和 java 安装也是如此。我不明白为什么 eclipse 使用 jre 60。我还检查了首选项并将 jre 版本更改为 65。不走运。此外,我在没有通过命令行使用 eclipse 的情况下运行了一个简单的 java 文件,并且运行/编译得很好。我尝试在 eclipse.ini 中添加 -vm 标签(它在那里不存在)并将其设置为 jvm 但它没有帮助。(我比删除它)我不知道该怎么做...请帮忙,我已经尝试了所有我知道的方法。谢谢!

EDIT:

编辑:

My eclipse.ini file below:

我的 eclipse.ini 文件如下:

-startup
../../../.p2/pool/plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.library
../../../.p2/pool/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-install
C:/Users/Sanjiv/eclipse/java-mars/eclipse
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms256m
-Xmx1024m
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/

EDIT 2I have already tried reinstalling java, eclipse and jdk.

编辑 2我已经尝试重新安装 java、eclipse 和 jdk。

采纳答案by Ashwin Gupta

Ok, so after a bit of digging, I managed to fix the problem. In eclipse, I went to Windows>Preferences>Java>Installed JREs>Execution Enviorments>JavaSE-1.8>Compatible JREs>jre1.8.0_65(perfect match). I have no idea why or how that changed, (or why it worked) but hey, I'm not complaining. For anyone else with the same issue, first do everything I said in the question body, then try this. It hopefully will work for you too.

好的,经过一番挖掘,我设法解决了这个问题。在 eclipse 中,我去了Windows>Preferences>Java>Installed JREs>Execution Enviorments>JavaSE-1.8>Compatible JREs>jre1.8.0_65(perfect match). 我不知道为什么或如何改变,(或为什么有效)但是嘿,我不是在抱怨。对于有同样问题的其他人,首先按照我在问题正文中所说的做,然后尝试这个。希望它也对你有用。

EDIT: I just figured out the cause of the issue as well. I opened the workspace on another computer (my workspace is on a shared drive) running java 1.8.0_60 while this computer is running java 1.8.0_65. Obviously, eclipse had to change the version therefore causing problems.

编辑:我也刚刚找出了问题的原因。我在另一台运行 java 1.8.0_60 的计算机上打开了工作区(我的工作区在共享驱动器上),而这台计算机运行的是 java 1.8.0_65。显然,eclipse 必须更改版本,因此会导致问题。

回答by Deepika

For windows user, if your getting this error:

对于 Windows 用户,如果您收到此错误:

Java Virtual Machine Launcher- Error: could not open C:\Program Files\Java\jre1.8.0_60\lib\amd6jvm.cfg

Java 虚拟机启动器 - 错误:无法打开 C:\Program Files\Java\jre1.8.0_60\lib\amd6jvm.cfg

it indicates there is no jre1.8.0_60 version in your system. So you need to set the JRE version which is already there in our system by executing the below command:

它表示您的系统中没有 jre1.8.0_60 版本。因此,您需要通过执行以下命令来设置我们系统中已经存在的 JRE 版本:

  1. Go to cmd prompt
  2. go to the eclipse folder (which you have installed) by executing: cd eclipse-folder-path
  3. execute below command: eclipse -vm jre_path
    ex:

    eclipse -vm "C:\Program Files\Java\jdk1.8.0_131\jre\bin\javaw" 
    
  1. 进入 cmd 提示符
  2. 执行以下命令转到 eclipse 文件夹(已安装): cd eclipse-folder-path
  3. 执行以下命令:eclipse -vm jre_path
    例如:

    eclipse -vm "C:\Program Files\Java\jdk1.8.0_131\jre\bin\javaw"