Java Eclipse 无法识别 JVM 1.8

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

Eclipse not recognizing JVM 1.8

javaeclipsemacos

提问by joseph_pindi

Still trying to get Eclipse IDE to work and running into Incompatible JVM error. I followed the steps here: I installed Java 7 but Eclipse keep saying that 1.6 is not suitable for this product

仍在尝试让 Eclipse IDE 工作并遇到不兼容的 JVM 错误。我按照这里的步骤操作:我安装了 Java 7 但 Eclipse 一直说 1.6 不适合这个产品

But unfortunately to no effect. Running OSX 10.9.5 and uninstalled the out-of-the-box version of Mac. The new version of Java seems to show up in the System Preferences. Please see attached screen capture. I've even done some of the basics like restart my computer, etc. Maybe there are other modifications I need to make to other files. I'm comfortable with Terminal but new to Eclipse and Java. Thanks in advance! Screen shot of Terminal, System Preferences and Eclipse error message

但不幸的是没有效果。运行 OSX 10.9.5 并卸载 Mac 的开箱即用版本。新版本的 Java 似乎出现在系统偏好设置中。请参阅随附的屏幕截图。我什至已经完成了一些基本操作,例如重新启动计算机等。也许我还需要对其他文件进行其他修改。我对终端很满意,但对 Eclipse 和 Java 不熟悉。提前致谢!终端、系统首选项和 Eclipse 错误消息的屏幕截图

采纳答案by joseph_pindi

OK, so I don't really know what the problem was, but I simply fixed it by navigating to here http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmland installing 8u74 instead of 8u73 which is what I was prompted to do when I would go to "download latest version" in Java. So changing the versions is what did it in the end. Eclipse launched fine, now. Thanks for everyone's help!

好的,所以我真的不知道问题是什么,但我只是通过导航到这里http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html并安装来修复它8u74 而不是 8u73,这是我在 Java 中“下载最新版本”时被提示执行的操作。所以最终改变了版本。现在 Eclipse 启动得很好。感谢大家的帮助!

edit: Apr 2018- Now is 8u161 and 8u162 (Just need one, I used 8u162 and it worked.)

编辑:2018 年 4 月-现在是 8u161 和 8u162(只需要一个,我使用了 8u162 并且它有效。)

回答by Maciej Cygan

Open up terminal and check what java version is currently set in your path variable.

打开终端并检查当前在路径变量中设置的 Java 版本。

You can do that by typing in your terminal

您可以通过在终端中输入来做到这一点

java -version // this will check your jre version. 
javac -version // this will check your compiler version

If this shows incorrect java version but you have installed java 1.8 then you have to set path variable to the newer version of java.

如果这显示不正确的 java 版本但您安装了 java 1.8,那么您必须将路径变量设置为较新版本的 java。

To do that do add the line:

为此,请添加以下行:

export JAVA_HOME=/path/to/java/jdk1.x

to ~/.bash_profile(same as /Users/username/.bash_profile)

~/.bash_profile(同/Users/username/.bash_profile

Then do this from the terminal to set the new variable

然后从终端执行此操作以设置新变量

source ~/.bash_profile

Also what's your eclipse.ini set to ?

另外你的 eclipse.ini 设置为什么?

-Dosgi.requiredJavaVersion=1.7

EDIT:

编辑:

Please open up terminal and type

请打开终端并输入

 find / -name "java" // This should find all folder named java on your file system.

Also how did you install java in the first place ?

另外你是如何安装java的?

回答by John

I have had the same problem as noted above. I could not get Eclipse to install because of Java incompatibilities. The sequence I followed goes like this:

我遇到了与上述相同的问题。由于 Java 不兼容,我无法安装 Eclipse。我遵循的顺序是这样的:

  1. Upgraded to MAC OS Sierra
  2. Downloaded the Eclipse installer but was prompted that I needed to instal a legacy Java.
  3. Installed Java 1.6
  4. Was unable to install Eclipse and was prompted that I needed Java 1.7 or greater. Downloaded and installed Java 1.8
  5. Ran the terminal code 'java -version' // this will check your jre version. This showed returned Java 1.6 despite the fact that I had upgraded to 1.8. The Java version listed in the Java control panel said 1.8
  6. Tried multiple downloads of eclipse and Java and multiple restarts always with the same result.
  7. Visited the Oracle web page noted above: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmlI could not find the above reference to 8u73 and 8u74 but I did find and option to download 1.8.0_12. I did this. It installed without difficulty, and then I was able to install Eclipse without difficulty.
  1. 升级到 MAC OS Sierra
  2. 下载了 Eclipse 安装程序,但提示我需要安装旧版 Java。
  3. 已安装 Java 1.6
  4. 无法安装 Eclipse 并提示我需要 Java 1.7 或更高版本。下载并安装 Java 1.8
  5. 运行终端代码 'java -version' // 这将检查您的 jre 版本。尽管我已升级到 1.8,但这显示返回了 Java 1.6。Java 控制面板中列出的 Java 版本显示为 1.8
  6. 尝试多次下载 eclipse 和 Java,多次重启总是得到相同的结果。
  7. 访问了上面提到的 Oracle 网页:http: //www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html我找不到上面对 8u73 和 8u74 的引用,但我确实找到了选项下载 1.8.0_12。我这样做了。它没有困难地安装,然后我能够毫无困难地安装 Eclipse。

This took hours of my time. I hope this proves useful.

这花了我几个小时的时间。我希望这证明是有用的。

回答by todclifton

Echoing the answer, above, a full install of the JDK (8u121 at this writing) from here - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html- did the trick. Updating via the Mac OS Control Panel did not update the profile variable. Installing via the full installer, did. Then Eclipse was happy.

回应上面的答案,从这里完整安装 JDK(在撰写本文时为 8u121) - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html- 成功了. 通过 Mac OS 控制面板更新不会更新配置文件变量。通过完整安装程序安装,确实如此。然后Eclipse很高兴。

回答by Aidin

JRE is a Run-Time Environment for running Java stuffs on your machine. What Eclipse needs is JDK as a Development Kit.

JRE 是一个运行时环境,用于在您的机器上运行 Java 内容。Eclipse 需要的是 JDK 作为开发工具包。

Install the latest JDK (and not JRE) from http://www.oracle.com/technetwork/pt/java/javase/downloads/jdk8-downloads-2133151.htmland you should be good on Mac!

http://www.oracle.com/technetwork/pt/java/javase/downloads/jdk8-downloads-2133151.html安装最新的 JDK(而不是 JRE),你应该在 Mac 上很好!

回答by suyog shinde

Here are steps:

以下是步骤:

  • download 1.8 JDK from this site
  • install it
  • copy the jre folder & paste it in "C:\Program Files (x86)\EclipseNeon\"
  • rename the folder to "jre"
  • start the eclipse again
  • 从此站点下载 1.8 JDK
  • 安装它
  • 复制 jre 文件夹并将其粘贴到“C:\Program Files (x86)\EclipseNeon\”
  • 将文件夹重命名为“jre”
  • 再次开始日食

It should work.

它应该工作。

回答by Natasha

For some weird reason "Java SE Development Kit 8u151" gives this trouble. Just install, "Java SE Development Kit 8u152" from the following link-

出于某种奇怪的原因,“Java SE Development Kit 8u151”给了这个麻烦。只需从以下链接安装“Java SE Development Kit 8u152”-

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

It should work then.

它应该工作。