16

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?

Jamie Clinton
  • 286
  • 1
  • 2
  • 9

6 Answers6

10

I solved this issue in my mac with yosemite:

  1. Installed JDK for MACOSX 64bits from https://jdk8.java.net/download.html
  2. Inside the eclipse.ini I put this line:

    -vm /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home

And it worked for me!

hichris123
  • 10,145
  • 15
  • 56
  • 70
Rem Morales
  • 101
  • 2
  • 3
8

Download 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)

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • It appears that for OS X Java 6 is not in the test matrix, only oracle 7+8 (but Java 6 is for all other platforms) http://www.eclipse.org/eclipse/development/readme_eclipse_4.4.php#TargetOperatingEnvironments. Perhaps the 32-bit download should be removed then . – Thorbjørn Ravn Andersen Jul 07 '14 at 02:17
4

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 use

Solution:

Open the directory where you have Eclipse copy in your computer.

You would see a file name eclipse press control key and click on it to see the options.

Then click on Show Originalfrom the options, there you would find eclipse.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 error

Muhammad
  • 921
  • 2
  • 11
  • 29
1

Try adding the following lines to your eclipse.ini:

-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home

Maybe a newer version of eclipse could help, too (if yours is out of date).

atamanroman
  • 11,607
  • 7
  • 57
  • 81
1

Take a look in your System Preferences -> Java. It should open the Java 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

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

To check if it worked, run java -version and you should see something like

java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

Try 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:

enter image description here

This is on my Eclipse Luna:

enter image description here

Alexandre Santos
  • 8,170
  • 10
  • 42
  • 64
1

Download the 64-bit version of Eclipse.

This solved the problem. Thanks everyone.

Jamie Clinton
  • 286
  • 1
  • 2
  • 9