简体   繁体   中英

Eclipse on Mac 10.8 - Installed 1.7.0 JRE / JDK, but Eclipse won't launch

  • 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 ; /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)

The best answer is to fix the Java 7 installation as shown here : https://stackoverflow.com/a/19594116
Simple to do and I have confirmed it works on Mavericks. With this fix, you can launch your app from the launchpad as usual. If you upgrade your JDK, you will have to reapply the fix to the new installation.

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

I found the answer over on Ask Different

It's an ugly hack, but works perfectly.

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.

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.

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

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.

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

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>

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 -- ie installing JDK 7u17 first before installing Java SE 6 as suggested in the message.

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.

If you'd like to install Java 6 JDK only (no Java 7 JDK/JRE, no Java 6 JRE only), install the Apple OSX Java DMG (at time of writing, this was http://adcdownload.apple.com/Developer_Tools/java_for_os_x_2013003_developer_package/java_for_os_x_2013003_dp__11m4406.dmg ).

You still won't be able to start Eclipse. Make a directory JavaVirtualMachines under /System/Library/Java . And then make an Alias of the java version folder at /Library/Java/JavaVirtualMachines and rename the alias 1.6.0.jdk and copy that alias to /System/Library/Java/JavaVirtualMachines/

After finished, you will have an Alias at /System/Library/Java/JavaVirtualMachines/1.6.0.jdk that points to the Java install directory at */Library/Java/JavaVirtualMachines/1.6.0_XX-XXX-XXX.jdk*

  1. Install latest JDK from Sun, it installs into /Library/Java/JavaVirtualMachines/ , eg /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)

How to Make Eclipse Run on OS X 10.9 Mavericks

Attempting to launch various Eclipse versions after the Mavericks upgrade pops up a dialog with this message:

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

在此输入图像描述

It turns out that Java 7 is disabled by default in OS X 10.9.
This is easily verified as follows:

$ java --version
No Java runtime present, requesting install.

The solution is to install the latest supported Java version from Apple support: Java for OS X 2013-005 ( http://support.apple.com/kb/DL1572 )
As of 10/15/13 this would be Java SE 6 1.6.0_65.
Post Date: Oct 15, 2013
File Size: 63.98 MB

After the install, Eclipse will run as expected from the Dock, the Finder, or the Terminal without any tricks, hacks, or work-arounds.

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

I found the same problem (Mac OS X 10.9.2, Java 1.7.0_53b13, Eclipse Kepler). The workaround was quite easy:

  1. Find the executable in Finder (CMD+Click on Eclipse's icon in the Dock)
  2. Remove the icon from the Dock
  3. CTRL+Click on the executable in Finder
  4. ALT+Open (to allow the execution of a non-signed application)
  5. Eclipse opens normally and without any problem
  6. Re-dragged the program onto the Dock

I had this problem and found that I did not have JDK installed on my Mac. Once I did that, Eclipse starts normally.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM