简体   繁体   中英

Eclipse thinks I only have Java 1.6, but when checking java-version in terminal it displays 1.7. Help :)

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.

我确定您必须这样做,但以防万一您无法确保为Java设置了环境变量

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM