0

I just downloaded Eclipse, and it said "Version 1.7 or greater is required" for Java. Then I downloaded Java 1.7 and installed it and all that, and even restarted my computer. When I check my Java version in the terminal, it says Java 1.7, so why can't Eclipse recognize Java 1.7?

Thanks a lot! :)

My question isn't a duplicate of Running Eclipse on Mac - JVM Version 1.7 or greater is required because I installed the entire JDK 7 and my computer recognizes Java 1.7. Right now, I can't even open Eclipse.

EDIT: current steps I have taken:

1) finding the path (/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home) to java 1.7 with command "/usr/libexec/java_home -v 1.7"

2) pasting this path by adding the following in the eclipse.ini file,

-vm

/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

Error message is still:

Version 1.6.0_65 of the JVM is not suitable for this product. Version: 1.7 or greater is required.

Community
  • 1
  • 1
Shua Lam
  • 1
  • 1
  • 4
  • There isn't a lot of information to go on here. How is your build environment configured? Are you talking about the Java runtime or the jdk? – SBI Jun 24 '15 at 08:09
  • 2
    Possible duplicate of http://stackoverflow.com/questions/25387267/running-eclipse-on-mac-jvm-version-1-7-or-greater-is-required – anselm Jun 24 '15 at 08:10
  • You can change your version to JDK 7 explicitly in eclipse. – Anil Reddy Yarragonda Jun 24 '15 at 08:15
  • I dont know how my build environment is configured... :( Sorry! Literally just downloaded Eclipse and when I click on the application it won't open because it thinks my Java version isn't correct. – Shua Lam Jun 24 '15 at 09:09

3 Answers3

0

I am sure you must have done this but just in case you haven't can you make sure the environment variable's are set for Java

Mudassar
  • 3,135
  • 17
  • 22
  • Sorry, what does this mean? – Shua Lam Jun 24 '15 at 08:21
  • Have a look at this link and let me know if the path is set. If it still doesn't work do let me know. https://www.java.com/en/download/help/path.xml – Mudassar Jun 24 '15 at 08:23
  • I'm using a mac and putting in "java -version" gives me "java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)". Does that mean the path is set? – Shua Lam Jun 24 '15 at 08:30
  • no worries, kindly go through this link of how it is done on a mac http://stackoverflow.com/questions/22842743/setting-java-home-environment-variable-on-mac-osx-10-9 If you are still stuck do let me know – Mudassar Jun 24 '15 at 08:44
  • Ok, so I'm sure that the path is set to Java 1.7 now. I followed the instructions on the link you provided as well. I feel like my computer is good with 1.7, but for some reason, Eclipse won't recognize Java 1.7... – Shua Lam Jun 24 '15 at 09:08
0

Have you tried Window -> Preferences -> Java -> Installed JREs?

There you can add (Using the Standard VM option) a JDK (or JRE) by setting the path to the JDK install directory.

m.mitropolitsky
  • 125
  • 2
  • 10
  • Is this 'window' from Eclipse? Because I can't open Eclipse :( But for my macbook's system preferences, when I check on Java, it's version 1.7 – Shua Lam Jun 24 '15 at 09:05
  • Hmmm... Now I feel like things don't make sense. So I edited the eclipse.ini file and added in "-vm /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home" in two lines. I found the path to my JDK using the command "/usr/libexec/java_home -v 1.7". Thus, the path eclipse uses to find java has explicitly been set to version 1.7. When I click on the Eclipse to launch it, however, the message is "Version 1.6.0_65 of the JVM is not suitable for this product. Version 1.7 or greater is required." – Shua Lam Jun 24 '15 at 10:11
0

right click on

project --> properties --> java compiler

and see the jdk compiler compliance level option set to 1.7 compiler, if not change it to 1.7 or higher

EDIT :-

eclipse by default will take java installation path from %JAVA_HOME% variable, firstly you check whether you have set JAVA_HOME path in your machine.

or you can manually set java path in eclipse.ini file as said in this post

How do I set the Java path in Eclipse so I can run it on an external drive?

and

How to specify jdk path in eclipse.ini on windows 8 when path contains space

Community
  • 1
  • 1
pappu_kutty
  • 2,378
  • 8
  • 49
  • 93
  • Is there a way to do this without having Eclipse already open? I can't open Eclipse at all – Shua Lam Jun 24 '15 at 09:10
  • Sorry, how do I check for the JAVA_HOME path? – Shua Lam Jun 24 '15 at 09:17
  • Is eclipse.ini a file I'm supposed to have? I tried searching for it and I don't think I have it? Sorry for all the trouble! – Shua Lam Jun 24 '15 at 09:19
  • yes eclipse.ini file is must, i have used on my windows lap, for mac, check this post for the file location http://stackoverflow.com/questions/15454889/eclipse-ini-file-not-present – pappu_kutty Jun 24 '15 at 09:25
  • So I've found eclipse.ini. I go to the terminal and check whereis java, and I get '/usr/bin/java'. Now I edit eclipse.ini, and I add '-vm ../usr/bin/java' to the beginning of the file in two lines. When I try to open Eclipse now, it says, no Java virtual machine was found after searching '../usr/bin/java'. Does this mean the path I put into eclipse.ini is wrong? How do I find the path? Thanks SO much!! – Shua Lam Jun 24 '15 at 10:00
  • you java installation path should also have jre folder inside. if not you will get this error – pappu_kutty Jun 24 '15 at 10:31
  • hmm... so after reading your comment, i just downloaded JRE 7. Now I just have a jre folder in my downloads. How would I move it into the java installation path? Thanks so much! Sorry I don't know how to do anything... – Shua Lam Jun 24 '15 at 10:58
  • try mapping the eclipse.ini to jre path, and start you eclipse – pappu_kutty Jun 24 '15 at 11:20