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

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

问题描述

我正在尝试获得使用Eclipse的新的1.7 JDK (这是Oracle的官方发行版)。



我不是说只是指向Eclipse,所以你可以在项目中使用它,这很好,但实际上使Eclipse运行在1.7 JVM。

我已经将新的JVM移动到Java首选项列表的顶端,但是Eclipse仍然以1.6开头。如果我在Java首选项中禁用1.6,那么在双击Eclipse之后,我会立即得到一个对话框,说无法创建Java虚拟机。



编辑: 我在-vmargs之前添加了以下eclipse.ini文件:

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

Eclipse安装细节对话框我仍然看到:

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

编辑2 :这是eclipse.ini文件的内容: https://gist.github.com/2512578

解决方案

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

 #!/ 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上的应用程序。


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

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.

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".

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

Yet in the Eclipse installation details dialog I still see:

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

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

解决方案

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

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.

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

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