86

I have just made a clean installation of OS X Mavericks, and I have downloaded Eclipse Kepler , but if I execute it, gives me this message:

enter image description here

Asking me to install Runtime Java SE 6; I have already installed Java 7, and if I press Install in that dialog, download and install it, and open Eclipse again, the dialog appears again.

How I can fix it?

josliber
  • 43,891
  • 12
  • 98
  • 133
Piero
  • 9,173
  • 18
  • 90
  • 160
  • I had this error before in previous OSX versions, you have to rollback to JDK 6 then back to 7. PITA, I know. – MLProgrammer-CiM Oct 24 '13 at 10:48
  • 2
    If you have a JRE installed, you should be able to chose that JRE from `Preferences -> Java -> Installed JREs` and then add the JRE 7 to the list of installed JREs - should solve the problem I presume... I guess this won't help much, if you can't open Eclipse at all - is that the case? – Darwind Oct 24 '13 at 10:49
  • 1
    @Darwind i can't open Eclipse...if i double click on the Eclipse icon appears that dialog... – Piero Oct 24 '13 at 10:51
  • 1
    I got prompted once for one of my Eclipse RCPs (and not for another I had started earlier!), it hasn't prompted again. – greg-449 Oct 24 '13 at 11:07
  • A manual install might work, see this question: http://stackoverflow.com/questions/19533528/installing-java-on-osx-10-9-mavericks – greg-449 Oct 24 '13 at 11:11
  • 2
    it works, after the yes install, i have reboot the computer and now works! – Piero Oct 24 '13 at 12:38
  • It works but need re-login. no need to reboot. (osXmavs) – tbraun Jan 12 '14 at 12:44

7 Answers7

208

This is in part due to Oracle's missing definitions of the JRE8 VM capabilities.

In case you don't want to install JRE6 at all and simply use JRE8 without symlinking it to the JRE6 either you can do the following:

Copy the Info.plist located at the path named below to e.g. ~/Downloads/:

/Library/Java/JavaVirtualMachines/jdk.1.8.<…>/Contents/

and then replace

<key>JVMCapabilities</key>
 <array>
  <string>CommandLine</string>
 </array>

with the following:

<key>JVMCapabilities</key>
 <array>
  <string>JNI</string>
  <string>BundledApp</string>
  <string>CommandLine</string>
 </array>

Afterwards copy the file back to its original location (you need administrator rights). For this change to take effect you need to log out of your account (and back in) or restart your computer. The dialog for Java 6 should shouldn't appear anymore and Eclipse should launch just fine using JRE8 (or JRE7). The same holds true for any other application that initially asks for Java, e.g. Adobe's Creative Suite.

On a related note it appears that this plist change sticks even after updates done through the Java Preference Panel in the System Preferences.

If it still doesn't work. You might need to add some folders and a symlink (details):

sudo mkdir -p /Library/Java/JavaVirtualMachines/jdk1.8.0_*.jdk/Contents/Home/bundle/Libraries
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_*.jdk/Contents/Home/jre/lib/server/libjvm.dylib /Library/Java/JavaVirtualMachines/jdk1.8.0_*.jdk/Contents/Home/bundle/Libraries/
sudo mkdir -p /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
sudo mkdir -p /System/Library/Java/Support/Deploy.bundle
gregers
  • 12,523
  • 8
  • 46
  • 41
Nikolas Grottendieck
  • 2,548
  • 1
  • 24
  • 24
  • After this I had a the error "App can't be opened because it is from an unidentified developer", the following question has the solution: http://stackoverflow.com/questions/19551298/app-cant-be-opened-because-it-is-from-an-unidentified-developer – Jonoabroad Oct 31 '13 at 03:01
  • This worked. Thanks. After opening eclipse I did see "The container 'JRE System Library [JavaSE-1.7]' references non existing library '/System/Library/Java/Extensions/AppleScriptEngine.jar'". I removed the WebStart and Applets entries and the error went away. – Aaron Roller Oct 31 '13 at 09:51
  • Thanks, it works! I can confirm it by opening Kelper after rebooting OSX Maverick with this quick fix. No Java 6 is needed at all. – Ken Pega Nov 04 '13 at 02:23
  • 6
    I can confirm that a reboot is absolutely not needed. I just logged out and logged in again. Probably is enough to restart the finder, without even logging out, but I did not test it. – Carlo Nov 07 '13 at 09:00
  • 5
    Restarting Finder did it for me. – Trevor Dixon Nov 23 '13 at 22:21
  • 7
    Initially, this gave me the Eclipse error "Failed to create the Java Virtual Machine", but that was because my /usr/bin/java was symlinked to another 1.7 (the /Library/Internet/... plugins one instead of the /Library/Java... one). After fixing that link, this works beautifully for me - I wish I could give two upvotes! – sage Dec 28 '13 at 00:43
  • The folder JavaVirtualMachines was empty but the solution posted here: http://stackoverflow.com/a/21864759/48468 worked for me! – Gerardo Contijoch Aug 07 '14 at 11:46
  • Thanks for sharing. But it is by no way Oracle's fault. "definitions of the JRE7 VM capabilities" are not part of any Java Community Process Standard. – Joerg Ruethschilling Aug 10 '14 at 20:19
  • Thanks. I had the same issue after upgrading to Yosemite! This solved it. – Shobhit Puri Oct 19 '14 at 02:09
  • I had the same problem (running uDig, a GIS tool built on Eclipse). I applied the proposed fix of updating the plist. A finder restart was all I needed - almost. I got the "Failed to create the Java Virtual Machine" error that sage mentioned. Only in my case, symlinks were correct. The actual error was that the java runtime could not access library /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bundle/Libraries/libserver.dylib – Albert Godfrind Dec 01 '14 at 18:04
  • 2
    The explanation is in http://apple.stackexchange.com/questions/136975/lsopenurlswithrole-failed-with-error-10810 : "The error occurs because JVM failed to launch - the Java application itself has been hardcoded to load libserver.dylib. This file exist for Java 1.6 and older, but not for Java 1.7 and above. The solution is to manually symlink the library (found in Contents/Home/jre/lib/server/libjvm.dylib) into where it is expected. An ugly hack, but it solved my issue. – Albert Godfrind Dec 01 '14 at 18:10
  • I’m running Java 8, and the /Library/Java/JavaVirtualMachines/ folder is empty. But I stumbled across another solution here by commenter ‘eric3k’. http://oliverdowling.com.au/2014/03/28/java-se-8-on-mac-os-x/ It’s as simple as creating empty folders at “/System/Library/Java/JavaVirtualMachines/1.6.0.jdk” and “/System/Library/Java/Support/Deploy.bundle”. Worked for me! – Kal Jan 27 '15 at 16:55
  • I also confirm that it works, but the symlink was completely necessary in my case. Thanks a lot! – Iker Jamardo Zugaza Jul 21 '15 at 00:01
7

To be able to run Eclipse with Java 7 (Oracle), I launch Eclipse using this file: eclipse/Eclipse.app/Contents/MacOS/eclipse. "eclipse" folder contains alias for this file by default. So all that you need to do is to double-click the alias named "eclipse".

Also Oracle warns that Oracle's Java version 7u25 and below have been disabled by Apple on OS X (see here). I had upgraded to the latest JDK version before I found out the way of launching Eclipse with Java 7. So I don't know if the upgrade is necessary or not.

7

I had this problem after a Mavericks install. I was able to solve it by installing Java from the Apple download at http://support.apple.com/kb/dl1572

I hope this helps.

Bob Lee
  • 95
  • 1
  • 1
3

You need to download and install the JAVA for MAC manually. That is what worked for me.

Download here: http://support.apple.com/kb/DL1572?viewlocale=en_US

Scott
  • 993
  • 3
  • 10
  • 28
1

I happened to get it running without a procedure like the suggestions above. I erased the eclipse folder and then copied it back from the trashcan. Please verify if it works for you.

Spooky
  • 2,966
  • 8
  • 27
  • 41
1

On MAC OS X, after installing JRE 7 from Oracle using the .dmg download, on opening Eclipse, it still pointed back to my old JRE 6.

After numerous google searches for the problem, and getting here, in desperation I clicked on "Search" in Eclipse --> Preferences --> Installed JREs and voila - it picked up JRE 7.

1

In my case, with Eclipse 4.5.1 Mars (installed from the OS X installer, downloaded from eclipse.org) and OS X El Capitan:

Greg Dubicki
  • 5,983
  • 3
  • 55
  • 68