如何在JDK 1.7 OSX上运行Eclipse Indigo

如何在JDK 1.7 OSX上运行Eclipse Indigo

问题描述:

使用Oracle最近发布的OSX JDK 7 ea.如何运行Eclipse Indigo?

With the recently OSX JDK 7 ea release from Oracle. How to run Eclipse Indigo ?

我收到以下错误消息:

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home
$ java -version
openjdk version "1.7.0-ea"
OpenJDK Runtime Environment (build 1.7.0-ea-b211)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)
$ /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library. 

我自己尝试了一下,但遇到了一些麻烦,所以我想我将分享最终对我有用的东西:

I just tried this myself and had some complications so I thought I would share what ended up working for me:

  1. 下载并安装 Java的Mac OSX版本SE开发套件7
  2. 在Eclipse->首选项-> Java->已安装的JRE下,单击添加,选择Mac OS X VM,然后单击下一步.
  3. 输入"/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home"作为JRE主目录,输入类似"Java SE 7"的合理名称作为JRE名称,然后单击完成". (请注意,您将无法导航到"../Contents/Home"文件夹.您必须手动输入.)
  4. 将新的JRE添加到已安装Eclipse的JRE列表中之后,选中刚添加的新JRE旁边的框,然后单击确定".
  5. 现在在Eclipse->首选项-> Java->编译器下,从编译器遵从性级别"下拉列表中选择1.7,然后单击确定".
  1. Download and install Mac OSX version of Java SE Development Kit 7
  2. Under Eclipse -> Preferences -> Java -> Installed JREs, click Add, select Mac OS X VM, then click Next.
  3. Enter "/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home" as the JRE home directory, enter something reasonable like "Java SE 7" as the JRE name, and then click Finish. (Note that you won't be able to navigate to the "../Contents/Home" folder. You will have to type it in manually.)
  4. After adding the new JRE to the list of Eclipse installed JREs, check the box next to the new JRE that you just added and then click OK.
  5. Now under Eclipse -> Preferences -> Java -> Compiler, select 1.7 from the "Compiler compliance level" dropdown and click Ok.

希望这对遇到问题的人有所帮助.对我而言,令人困惑的部分是在Eclipse中选择了JRE主目录,因为我无法导航至该目录.

Hope this helps someone who has problems figuring this out. The confusing part for me was selecting the JRE home directory in Eclipse, since I wasn't able to navigate to it.