Java 在 Mac 上运行 Eclipse - 需要 JVM 1.7 或更高版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25387267/
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
Running Eclipse on Mac - JVM Version 1.7 or greater is required
提问by Tchaikovsky
I downloaded Eclipse (specifically that for C/C++ Programming) for Mac, running OSX Mavericks. When I try to start Eclipse, it gives me this message: "Version 1.6.0_65 of the JVM is not suitable for this product. Version 1.7 or greater is required", and it doesn't open. I installed Java version 7, but nothing changed. I don't know how else to update the JVM (I don't know much about Java in general).
我为 Mac 下载了 Eclipse(特别是用于 C/C++ 编程的那个),运行 OSX Mavericks。当我尝试启动 Eclipse 时,它给了我以下消息:“JVM 的 1.6.0_65 版不适合此产品。需要 1.7 版或更高版本”,并且它没有打开。我安装了 Java 版本 7,但没有任何改变。我不知道如何更新 JVM(我一般对 Java 了解不多)。
I downloaded the 64-bit version for my MacBook Air, if that matters.
如果重要的话,我为我的 MacBook Air 下载了 64 位版本。
采纳答案by Nadeem
Simply Install the JDK 7 or JDK 8, and not just the latest JRE.
只需安装 JDK 7 或 JDK 8,而不仅仅是最新的 JRE。
回答by Richard-Degenne
Run whereis java
in a Terminal. It will normally display something like /usr/bin/java
.
whereis java
在终端中运行。它通常会显示类似/usr/bin/java
.
Now run java -version
. It shows you 'java version 1.6.0_65' or something approaching. This is because Java 7 does not replace Java 6. Java 7 is installed as an Internet Plug-in and can be found in /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
.
现在运行java -version
。它向您显示“java 版本 1.6.0_65”或即将到来的内容。这是因为 Java 7 不会取代 Java 6。Java 7 作为 Internet 插件安装,可以在/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
.
What you need to do is to symlink /usr/bin/java
to /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
.
您需要做的是符号链接/usr/bin/java
到/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
.
Restart Eclipse, or reboot your computer (I don't know how Eclipse manages this), and it should do the trick. :)
重新启动 Eclipse,或者重新启动您的计算机(我不知道 Eclipse 如何管理这个),它应该可以解决问题。:)
回答by user3552900
I went to oracle downloadsand the scrolled one of the several Mac osX links and downloaded jdk-8u73-nb-8_1-macosx-x64.dmg from oracle and that fixed the problem. I don't know why updating java doesn't do the trick.
我去了oracle 下载,滚动了几个 Mac osX 链接之一,并从 oracle 下载了 jdk-8u73-nb-8_1-macosx-x64.dmg 并解决了问题。我不知道为什么更新 java 不起作用。
回答by LKM
add this script into 'eclipse.ini' at the top '/Library/java/JavaVirtualMachines/jdk1.8.0_77.jdk/contents/Home/bin'
将此脚本添加到顶部“/Library/java/JavaVirtualMachines/jdk1.8.0_77.jdk/contents/Home/bin”的“eclipse.ini”中
回答by CGnewbie
Trying to install eclipse, I installed java version 1.6.0_65 as it requested yet still was blocked from finishing the Eclipse install with the error that I needed 1.7 JVM or higher - not true, installing higher didn't work either. I tried installing jdk-8u101-macosx-x64.dmg and that didn't work. So, I tried JDK 7 as advised, sorry no good.
尝试安装 eclipse 时,我按照它的要求安装了 java 版本 1.6.0_65,但仍然无法完成 Eclipse 安装,错误是我需要 1.7 JVM 或更高版本 - 不是真的,安装更高版本也不起作用。我尝试安装 jdk-8u101-macosx-x64.dmg 但没有用。所以,我按照建议尝试了 JDK 7,抱歉不好。
So, to get the Eclipse installer to run with out that java error I had to edit the Info.plist inside the Eclipse Installer. Right click the Eclipse installer and show package contents, then open info.plist in textEdit.app
因此,为了让 Eclipse 安装程序在没有该 java 错误的情况下运行,我必须在 Eclipse 安装程序中编辑 Info.plist。右键单击 Eclipse 安装程序并显示包内容,然后在 textEdit.app 中打开 info.plist
(Note: So after several tries editing this plist and following methods mentioned elsewhere nothing worked, I found that you have to use the symlink or java alias because java is installed differently now a days as an internet plugin.)
(注意:因此,在多次尝试编辑此 plist 并遵循其他地方提到的方法后,没有任何效果,我发现您必须使用符号链接或 java 别名,因为现在 java 作为 Internet 插件的安装方式有所不同。)
Where you want to make an edit (You should probably Backup the original or you can download it again), under <key>Eclipse</key>
, then <array>
, delete out what's there and add <string>-vm</string>
and this string underneath; <string>/usr/bin/java</string>
在你想要编辑的地方(你应该备份原始文件或者你可以再次下载它),在<key>Eclipse</key>
,然后<array>
,删除那里的内容并<string>-vm</string>
在下面添加这个字符串;<string>/usr/bin/java</string>
Here is what mine looks like.
这是我的样子。
<key>Eclipse</key>
<array>
<string>-vm</string>
<string>/usr/bin/java</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
<string>-showlocation</string>
</array>
Then save and try running your eclipse installer; this worked for me.
然后保存并尝试运行您的 eclipse 安装程序;这对我有用。
回答by PINTU KUMAR
Just running the below command from there terminal worked for me.
只需从那里的终端运行以下命令即可为我工作。
brew cask install java
酿造桶安装java
It updated my idk with 1.8, and after that eclipse opens successfully.
它用 1.8 更新了我的 idk,之后 eclipse 成功打开。