Eclipse 错误:不兼容的 JVM,但是,无法更新 JVM

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

Eclipse error: Incompatible JVM, however, unable to update JVM

javaeclipsejvmjava-8

提问by user2981968

I get the following error when I open Eclipse:

打开 Eclipse 时出现以下错误:

Incompatible JVM : Version 1.6.0_65 of the JVM is not suitable for this product. Version 1.7 or greater is required.

JVM 不兼容:JVM 1.6.0_65 版本不适合本产品。需要 1.7 或更高版本。

My eclipse.ini file has -vm /System/Library/Java/JavaVirtualMachines/1.6.0.jdk(of course before -vmargs)

我的 eclipse.ini 文件有 -vm /System/Library/Java/JavaVirtualMachines/1.6.0.jdk(当然在 -vmargs 之前)

I have been trying to update to Java8 so I can get 1.8.0.jdk but it is not appearing at the above location, nor can I find it elsewhere.

我一直在尝试更新到 Java8,所以我可以获得 1.8.0.jdk,但它没有出现在上述位置,我也无法在其他地方找到它。

When I run java --version, I get the follow output:

当我运行时java --version,我得到以下输出:

java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

java 版本“1.8.0_05”Java(TM) SE 运行时环境(构建 1.8.0_05-b13)Java HotSpot(TM) 64 位服务器 VM(构建 25.5-b02,混合模式)

回答by OO7

As explained by @Anthony Accioly check for correct version of JDKlike :-

正如@Anthony Accioly 所解释的,检查 JDK 的正确版本,例如:-

If /usr/libexec/java_home -v 1.8.0_05 --exec javac -versionreturns the correct version, then your problem is with:

如果/usr/libexec/java_home -v 1.8.0_05 --exec javac -version返回正确的版本,那么您的问题在于:

/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK

With a privileged user execute:

使用特权用户执行:

cd /System/Library/Frameworks/JavaVM.framework/Versions/
rm CurrentJDK
ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/ CurrentJDK

For more detailon this click here After upgrading to Java8, javac still shows 1.7

有关更多详细信息,请单击此处升级到 Java8 后,javac 仍显示 1.7

Also check Error launching Eclipse 4.4 “Version 1.6.0_65 of the JVM is not suitable for this product. - stackoverflow

另请检查启动 Eclipse 4.4 时出错“JVM 的 1.6.0_65 版不适合此产品。- 堆栈溢出

回答by John Bannister

From the command line (Applications -> Utilities -> Terminal), run the command

从命令行(应用程序 -> 实用工具 -> 终端),运行命令

/usr/libexec/java_home

This will return the location of the 1.8 JDK. Incidentally, this shouldmatch

这将返回 1.8 JDK 的位置。顺便说一句,这应该匹配

echo $JAVA_HOME

if that variable is set.

如果设置了该变量。

回答by Thorbj?rn Ravn Andersen

You must use a 64-bit version of Eclipse 4.4 with OS X.

您必须在 OS X 上使用 64 位版本的 Eclipse 4.4。