Eclipse 在 Mac OSX 上仍然使用 java 6 作为 jre
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17584350/
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
Eclipse still using java 6 as jre on Mac OSX
提问by mrblippy
I have installed Eclipse SDK 3.7.1 on my mac, which is running mac osx 10.8.4. I am trying to get eclipse to use java 7, which is installed to /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/ But when I view eclipse's installation details it's still using to my old java 6 installation. Even after adding -vm /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java to the eclipse.ini file.
我已经在运行 mac osx 10.8.4 的 mac 上安装了 Eclipse SDK 3.7.1。我试图让 eclipse 使用 java 7,它安装到 /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/ 但是当我查看 eclipse 的安装详细信息时,它仍在使用我的旧 java 6 安装。即使在将 -vm /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java 添加到 eclipse.ini 文件之后。
Also edited the Info.plist file to point to java 7
还编辑了 Info.plist 文件以指向 java 7
Anyone have any suggestions here? I'm completely out of ideas.
有人在这里有什么建议吗?我完全没有想法。
Please note: I am a newbie with macs. Any suggestions, big or small would be greatly appreciated :)
请注意:我是 mac 的新手。任何建议,无论大小,将不胜感激:)
Contents of Info.plist
Info.plist 的内容
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>eclipse</string>
<key>CFBundleGetInfoString</key>
<string>Eclipse 3.7 for Mac OS X, Copyright IBM Corp. and others 2002, 2011. All rights reserved.</string>
<key>CFBundleIconFile</key>
<string>Eclipse.icns</string>
<key>CFBundleIdentifier</key>
<string>org.eclipse.eclipse</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Eclipse</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.7</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleLocalizations</key>
<array>
<string>ar</string>
<string>cs</string>
<string>da</string>
<string>el</string>
<string>en</string>
<string>es</string>
<string>de</string>
<string>fi</string>
<string>fr</string>
<string>hu</string>
<string>it</string>
<string>iw</string>
<string>ja</string>
<string>ko</string>
<string>nl</string>
<string>no</string>
<string>pl</string>
<string>pt_BR</string>
<string>pt</string>
<string>ru</string>
<string>sv</string>
<string>tr</string>
<string>zh_HK</string>
<string>zh_TW</string>
<string>zh</string>
</array>
<key>Eclipse</key>
<array>
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java</string>
<string>-keyring</string><string>~/.eclipse_keyring</string>
<string>-showlocation</string>
<!-- WARNING:
If you try to add a single VM argument (-vmargs) here,
*all* vmargs specified in eclipse.ini will be ignored.
We recommend to add all arguments in eclipse.ini
-->
</array>
</dict>
</plist>
回答by Petesh
If you're trying to get the VM that eclipse runs under to change then it's the Info.plist you need to modify, and it should be changed in the section that says how to specify the different VMs. In my case I changed it to run with the 1.6 VM using:
如果您试图更改运行 eclipse 的 VM,那么您需要修改 Info.plist,并且应该在说明如何指定不同 VM 的部分中对其进行更改。在我的情况下,我使用以下方法将其更改为与 1.6 VM 一起运行:
<string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java</string>
in the eclipse array of the plist.
在 plist 的 eclipse 数组中。
if you want to force a specific 1.7 VM, you use:
如果要强制使用特定的 1.7 VM,请使用:
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java</string>
Note, this is not the eclipse.ini
, this is the Eclipse.app/Contents/Info.plist
. This is because of the slightly different way that the Mac launches eclipse from other platforms
请注意,这不是eclipse.ini
,这是Eclipse.app/Contents/Info.plist
。这是因为 Mac 从其他平台启动 eclipse 的方式略有不同
回答by adriannieto
This question is answered in this topic How do I run Eclipse using Oracle's new 1.7 JDK for the Mac?
这个问题在本主题如何使用 Oracle 新的 1.7 JDK for Mac 运行 Eclipse 中得到解答?
My approach was this:
我的方法是这样的:
After installing Oracle JRE and JDK, open Info.plist inside Eclipse.app(right click, show contents) and paste after "Eclipse" "-vm/System/Library/Frameworks/JavaVM.framework/JavaVM"
Mine looks like this:
安装 Oracle JRE 和 JDK 后,打开 Eclipse.app 中的 Info.plist(右键单击,显示内容)并在“Eclipse”后粘贴“-vm/System/Library/Frameworks/JavaVM.framework/JavaVM”
我的看起来像这样:
<key>Eclipse</key> <array>
<string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/JavaVM</string>
<string>-keyring</string><string>~/.eclipse_keyring</string>
<string>-showlocation</string> </array>
If you do that, you will not have to update the file after upgrading JRE.
如果这样做,您将不必在升级 JRE 后更新文件。
回答by Waterloo Stu
In case anyone is encountering this too, for somereason my Java 7 seemed to be installed at the following path:
如果有人也遇到这种情况,出于某种原因,我的 Java 7 似乎安装在以下路径中:
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
/库/互联网插件/JavaAppletPlugin.plugin/Contents/Home
My Java 6 install was here: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
我的 Java 6 安装在这里:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
The Java 6 path makes some sense, and agrees with teh paths I've seen people mention on this particular issue, but no idea why the Java 7 path would be like that.
Java 6 路径有一定道理,并且同意我看到人们在这个特定问题上提到的路径,但不知道为什么 Java 7 路径会是那样。
回答by Juned Ahsan
In eclipse:
在日食中:
Go to Menu-> Window -> Preferences -> Java -> Installed JREs -> Remove the old JRE -> Add new JRE
转到菜单-> 窗口 -> 首选项 -> Java -> 已安装的 JRE -> 删除旧的 JRE -> 添加新的 JRE
回答by schtever
Try putting the path to the JDK bin directory as the argument to the -vm parameter. In other words, just trim the "/java" off of what you have now.
尝试将 JDK bin 目录的路径作为 -vm 参数的参数。换句话说,只需修剪掉您现在拥有的“/java”即可。