简体   繁体   中英

Eclipse doesn't find my java 8 library (mac)

I have installed java 8 SDK on my mac and terminal says java -version is java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode) bur when i create a project in eclipse with JSE 1.8 this is what happens: 在此输入图像描述

as you can see, no library is assigned:

在此输入图像描述

when i try to add a new environment, this is what i get: 在此输入图像描述 any help or suggestions?

您需要选择主页,例如/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home

The link to your Java 8 environment must be broken. Go to Window , Preferences , search "jre", select Installed JREs , and create a new environnment. Give the path to a JDK rather than a JRE. Then, right click on your project, Properties , Build path , Edit the current JRE and replace it with the new one.

You will also need to right click on your project, Properties , Java compiler , and set the compiler compliance to 1.8.

I have Eclipse Luna 4.4 on my Mac OSX 10.10 and I was having the same issue. I was able to resolve it by going to Preferences -> Java -> Installed JREs and "Add" the path to JRE home in the JDK: (/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre). That did it

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