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条回答
▲ chillily
2楼-- · 2020-02-08 11:31

I had same problem.

First of all ; JDK(java development Kit) and JRE(Java Runtime Environment) are different things. It was confused by people

In order to install eclipse yo should install latest JDK . So

  1. Visit http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  2. Download suitable version for your mac

  3. You can check your version now ; it won't be 1.6 anymore

  4. Try to install eclipse again , see it works.

Good luck!..

查看更多
你好瞎i
3楼-- · 2020-02-08 11:34

posted on this page: Mountain Lion with Java 7 only

To trick OS X to accept Java 7 instead of proposing to install Java 6 a simple symlink is enough:

sudo mkdir /System/Library/Java/JavaVirtualMachines

sudo ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

Most Java Programs will run with this little hack without the need to install Java 6. OS X's Java Preferences (and maybe some others) will not as it seems to explicitly check the version of the JVM when it is started.

script above can fix my problem.

查看更多
兄弟一词,经得起流年.
4楼-- · 2020-02-08 11:41

I had JDK 7 installed and I solved this issue for eclipse Kepler by running eclipse from the terminal instead of the finder.

./eclipse

Just thought to share.

Update 1

For the sake of completeness, if you want to run it from Finder as well, you can wrap the ./eclipse command into a .command file and run it from Finder (so that you don't have to open a terminal)

The following lines should do the job (don't forget to replace "your-full-eclipse-path" with the eclipse path on your machine)

#!/bin/sh
/your-full-eclipse-path/eclipse

After that, give execute permission to the eclipse.command file you just created

chmod +x eclipse.command
查看更多
叛逆
5楼-- · 2020-02-08 11:44
  1. Install latest JDK from Sun, it installs into /Library/Java/JavaVirtualMachines/, e.g. /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk

  2. sudo mkdir /System/Library/Java/JavaVirtualMachines

  3. sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/ /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

========= this trick used to work on Mountain Lion, but not on Maverick 10.9 somehow ============

Tried this again on Maverick, it does not work anymore. I also tried to change eclipse app plist and eclipse.ini (by adding -vm or ), does not work either.

Some people suggested that this is caused by Eclipse binary prepared using Apple 1.6 appbundler instead of Oracle java7 appbundler: Application is using Java 6 from Apple instead of Java 7 from Oracle on Mac OS X?

For now, please just type the eclipse from command line, which works fine with JAVA_HOME set to Java 7 (/usr/libexec/java_home command will tell you)

查看更多
走好不送
6楼-- · 2020-02-08 11:46

All these hacks does not work on mac Mavericks, But a simple and efficient solution is found here it worked with me like a charm.

Note: a drawback of this solution is when you check your java version using "java -version" command, it will read Java 1.6

查看更多
Deceive 欺骗
7楼-- · 2020-02-08 11:49

I wanted to run Eclipse itself with Java 7. As I have a couple of plugins that do not work without it. For me neither solution worked for 10.9, but I found a workaround. The main idea is that you start eclipse with java -jar launcher.jar and provide a couple of magic properties and then it starts. This guy provided the command line script in comments that works for me:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361#c25

查看更多
登录 后发表回答