如何使用适用于 Mac 的 Oracle 新 1.7 JDK 运行 Eclipse? [英] How do I run Eclipse using Oracle's new 1.7 JDK for the Mac?

查看:28
本文介绍了如何使用适用于 Mac 的 Oracle 新 1.7 JDK 运行 Eclipse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让 新的 1.7 JDK 与 Eclipse 一起使用(这是Oracle 正式发布).

I'm trying to get the new 1.7 JDK working with Eclipse (this is Oracle's official release).

我的意思不是仅仅将 Eclipse 指向它以便您可以在项目中使用它,这很好用,但实际上使 Eclipse 使用 1.7 JVM 运行.

I don't mean just pointing Eclipse to it so you can use it in projects, this works fine, but actually making Eclipse run using the 1.7 JVM.

我已将新的 JVM 移至 Java Preferences 列表的顶部,但 Eclipse 仍然从 1.6 开始.如果我在 Java 首选项中禁用 1.6,我会在双击 Eclipse 后立即收到一个对话框,提示无法创建 Java 虚拟机".

I've moved the new JVM to the top of the list in Java Preferences, but Eclipse still starts with 1.6. If I disable 1.6 in Java Preferences I get a dialog immediately after I double-click on Eclipse saying "Failed to create the Java Virtual Machine".

我在 -vmargs 之前将以下内容添加到我的 eclipse.ini 中:

edit: I added the following to my eclipse.ini just before the -vmargs:

-vm
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/bin/java

但在 Eclipse 安装详细信息对话框中,我仍然看到:

Yet in the Eclipse installation details dialog I still see:

java.runtime.version=1.6.0_31-b04-415-11M3646

edit 2:这里是我的 eclipse.ini 文件的内容:https://gist.github.com/2512578

edit 2: here are the contents of my eclipse.ini file: https://gist.github.com/2512578

推荐答案

我刚刚将我的评论添加到 https://bugs.eclipse.org/bugs/show_bug.cgi?id=339788 关于无法在 OS X 上使用带有 Eclipse 的新 Oracle JDK.在 eclipse 中使用 -vm 选项.ini 不起作用.我发现解决此问题的唯一方法是使用以下 shell 脚本:

I just added my comment to https://bugs.eclipse.org/bugs/show_bug.cgi?id=339788 regarding the inability to use the new Oracle JDK with Eclipse on OS X. Using the -vm option inside eclipse.ini does not work. The only way I found to work around this was to use the following shell script:

#!/bin/sh
#
export JAVA_HOME=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
LAUNCHER_JAR=/Applications/eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar

java 
-showversion 
-XX:MaxPermSize=256m 
-Xms1024m 
-Xmx1024m 
-Xdock:icon=/Applications/eclipse/Eclipse.app/Contents/Resources/Eclipse.icns 
-XstartOnFirstThread 
-Dorg.eclipse.swt.internal.carbon.smallFonts 
-Dosgi.requiredJavaVersion=1.5 
-jar $LAUNCHER_JAR

使用 http://mathiasbynens.be/notes/shell-script- 上的步骤mac-apps,我把上面的脚本变成了一个可以放在我的 Dock 上的应用程序.

Using the steps on http://mathiasbynens.be/notes/shell-script-mac-apps, I turned the script above into an application that I can keep on my dock.

这篇关于如何使用适用于 Mac 的 Oracle 新 1.7 JDK 运行 Eclipse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆