Eclipse on Mac 10.8 - Installed 1.7.0 JRE / JDK, b

2020-02-08 11:12发布

  • Installed Java SE 1.7.0u10 from Oracle w/ their installer package

  • Downloaded and unpacked Eclipse Juno (4.2.1)

  • Double click Eclipse purple icon and get OS X alert prompt with error message:

To open "Eclipse," you need a Java SE 6 runtime. Would you like to install one now?

  • (in terminal) which java - /usr/bin/java

  • ls -l /usr/bin/java - /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

  • (in Finder) Double click eclipse alias (included when unpacked download) - Terminal launches, /Applications/Eclipse/Eclipse.app/Contents/MacOS/eclipse ; exit ; and Exclipse launches without OS X alert prompt.

I've tried modifying the Eclipse app bundle plist to point the -vm key to /System/Library/Frameworks/JavaVM.frameworks/Versions/Current/Commands/java, but I feel like I probably shouldn't have to do this.`

I'd like to know how to get Eclipse to launch by just double clicking on the Application package. It's such a small thing to bug me... :o)

18条回答
冷血范
2楼-- · 2020-02-08 11:51

Hoping you are using 64-bit of Java SE 1.7.0 and so advising the following.

  1. go to Eclipse->Preferences...->Java->Installed JREs
  2. click Add...
  3. Select Standard VM
  4. paste /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home into JRE home
  5. Change the JRE name to something useful like Java SE 7
  6. Click Finish
  7. Check the check-box next to your newly created JRE.

You would need a restart.

查看更多
太酷不给撩
3楼-- · 2020-02-08 11:52

open /Library/Java/JavaVirtualMachines/jdkXXXXX.jdk/Contents/Info.plist

settting(<string>BundledApp</string> is usefull!):

<key>JVMCapabilities</key>
<array>
  <string>JNI</string>
  <string>BundledApp</string>
  <string>WebStart</string>
  <string>Applets</string>
  <string>CommandLine</string>
</array>
查看更多
该账号已被封号
4楼-- · 2020-02-08 11:53

For what it's worth, the Eclipse team seems to have worked around it by replacing their dlopen()-based method with a CFBundleCreate()-based one: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361

In case anybody has the same problem in their code that launches Java and does not want to resort to Apple-only APIs, I found an easier work-around: before dlopen()ing $JRE_HOME/lib/server/libjvm.dylib, make sure to open dlopen() $JRE_HOME/lib/jli/libjli.dylib. Then it won't ask to install Java 6.

查看更多
看我几分像从前
5楼-- · 2020-02-08 11:54

Can you imagine that? You have to install a JDK 1.6 to get eclipse ran properly, even if you already have jdk 1.7 installed, and set the JAVA_HOME properly.

To resolve your issue, you just need to download the jdk1.6 from http://support.apple.com/kb/DL1572?viewlocale=en_US, and install it, later you will be able to run eclipse, and you can set the JAVA_HOME to JDK1.7, and you will be able to find the JDK1.7 from eclipse "Preferences".

查看更多
做自己的国王
6楼-- · 2020-02-08 11:55

I had the exact same message when setting up a new mac and trying to run eclipse 4.2.2 with only Java SE 7 installed (as part of JDK 7u17).

In order to be able to successfully launch Eclipse I had to let OSX download and install Apple's Java SE 6 runtime first before installing the latest JDK.

After installing the JDK, the command java -version correctly shows:

java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

Trying to solve the problem the other way around didn't work -- i.e. installing JDK 7u17 first before installing Java SE 6 as suggested in the message.

查看更多
一纸荒年 Trace。
7楼-- · 2020-02-08 11:56

I had the exactly same problem some days ago and I solved it today. Just installed this http://support.apple.com/kb/dl1572

And after that, when I opened the eclipse the OSX installed some java update and opening eclipse by Eclipse.app started working.

Hope it works with you too.

查看更多
登录 后发表回答