Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I installed Java 7 but Eclipse keep saying that 1.6 is not suitable for this product

I'm using latest version of Eclipse Luna on Mac OS X 10.9.4. Whenever I try to open the Eclipse it says "version 1.6.0_65 of the JVM is not suitable for this product, version 1.7 or greater is required". I installed java 7 (JRE, I don't need JDK) but still I'm getting the same error. I tried java -version and the output was "java version 1.6.0_65". I can see the java icon on my system preferences. I also restarted my Mac to see if that works but that doesn't help either. I searched on google and some people suggesting other users to change Eclipse.ini file, the instructions wasn't clear and I'm a java beginner so I've no idea where and what to edit. Any step by step instructions will be appreciated.

like image 682
Anishka Jitendrabhai Vaghani Avatar asked Aug 03 '14 07:08

Anishka Jitendrabhai Vaghani


People also ask

Does Eclipse support Java 7?

Prerequisites. Java > Installed JREs preference page to register it with Eclipse. To convert an existing Java project to Java 7, open the Properties of the JRE System Library and choose Execution environment: JavaSE-1.7.

How do you solve incompatible JVM version 1.8 0_261 of the JVM is not suitable for this product version 11 or greater is required in Eclipse error?

If you're looking to resolve this without changing eclipse. ini file, just reinstall eclipse IDE. It can be the same version or newer one. I have reinstalled the same version and it's worked without issues, no needing of changing eclipse.

Is Java 1.6 the same as Java 6?

Version 6 is the product version, while 1.6. 0 is the developer version. The number 6 is used to reflect the evolving level of maturity, stability, scalability and security of Java SE.


2 Answers

I had this same problem with a fresh install of Eclipse Mars on OSX. I had installed the JRE from https://java.com/en/download/ (which is the top google search result for "java download" for me.

This failed for me with the same message "version 1.6.0_65 of the JVM is not suitable for this product, version 1.7 or greater is required"

Then I saw a comment that I should get the JRE/JDK from oracle instead:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

After downloading the most recent JDK from Oracle Eclipse starts fine.

like image 89
floatingpoint Avatar answered Oct 12 '22 00:10

floatingpoint


A potential solution to your problem might be to uninstall Java6 (provided by Apple itself) and only have Java7 installed in your system. This only applies in case you have no applications that desperately need the old Java6 version to be installed.

To remove the Apple-like Java6 installation open a Terminal and:

sudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

After this step you should only have Java7 by Oracle installed in your system. To verify, open another terminal and do a:

java -version

It should display something like "java version "1.7.0_XX" where XX is the current update version of the Java7 installation. If not: proceed with the next step.

Redefine the JAVA_HOME variable (to support IDEs like Eclipse and other developer tools...), which helps detecting where the "active" Java installation is situated in your system. Open a terminal and (Note: replace XX first!):

sudo rm /Library/Java/Home

sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_XX.jdk/Contents/Home /Library/Java/Home

Afterwards, a fresh installation of Eclipse should detect Java7 in your system and should work with this version out of the box. You can modify an installed Eclipse to use this installation by navigating in Eclipse to:

Preferences -> Java -> Installed JREs. Then remove the old Java6 system entry AND add new path (see above) with the name Java7.

like image 20
MWiesner Avatar answered Oct 12 '22 02:10

MWiesner