When I type java -version
in the console I get java version "1.8.0_05"
. The soft link /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
points to /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents
. In the java preferences window, the only listed version of Java is 1.8. JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
.
However, when I try to run Eclipse.app, I get the error: Version 1.6.0_65 of the JVM is not suitable for this product. Version: 1.7 or greater required.
I believe it is trying to use /System/Library/Java/JavaVirtualMachines
and in that directory the only version is 1.6.0.jdk
.
How can I get eclipse to use the correct version of Java?
I faced this same problem but rather than making it to use version 1.8 I changed the settings in
eclipse.ini
file so I can just run the program regardless which version of jvm does it want to useSolution:
Open the directory where you have Eclipse copy in your computer.
You would see a file name
eclipse
presscontrol
key andclick
on it to see the options.Then click on
Show Original
from the options, there you would findeclipse.ini
file open it with a text editor and change the-Dosgi.requiredJavaVersion=1.7
to-Dosgi.requiredJavaVersion=1.6
Save the file and open the
ecplise.app
it should open now without any errorDownload the 64-bit version of Eclipse instead of the 32-bit version.
The reason is that Eclipse contains native machine code (for the GUI) which is why there is both a 32-bit and 64-bit version of Eclipse, and this explicitly require the corresponding Java version. Originally Apple created both versions up to Java 6, but Oracle only creates a 64-bit version (much to the dismay of owners of older machines). So, if you download a 32-bit version of Eclipse it will only run with an Apple JVM, which apparently is too old (which surprise me - I thought Java 6 was still supported for Eclipse 4.4)
Download the 64-bit version of Eclipse.
This solved the problem. Thanks everyone.
Take a look in your
System Preferences
->Java
. It should open theJava Control Panel
. In the panel, check if you have one (or many) JDKs.I suspect you have many and are setting the JDK in your
.profile
while Eclipse is reading some other Java Home.You can change them manually by running this in your terminal
To check if it worked, run
java -version
and you should see something likeTry calling Eclipse now from the command line. To call Eclipse as an App, just set the Java8 through the
Java Control Panel
. This will be read when Eclipse starts.This is what I have on my
Java Control Panel
:This is on my Eclipse Luna:
I solved this issue in my mac with yosemite:
And it worked for me!
Try adding the following lines to your
eclipse.ini
:Maybe a newer version of eclipse could help, too (if yours is out of date).