Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse in OS X uses different version of Java than CLI

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?

like image 344
Jamie Clinton Avatar asked Jul 06 '14 17:07

Jamie Clinton


People also ask

What version of Java does eclipse use?

Current releases of Eclipse require Java 11 JRE/JDK or newer. A Java Development Kit (JDK) includes many useful extras for Java developers including the source code for the standard Java libraries. Regardless of your operating system, you will need to install some Java virtual machine (JVM).


2 Answers

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!

like image 105
Rem Morales Avatar answered Sep 23 '22 08:09

Rem Morales


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)

like image 45
Thorbjørn Ravn Andersen Avatar answered Sep 26 '22 08:09

Thorbjørn Ravn Andersen