简体   繁体   中英

JAVA HOME is set to 1.8 but eclipse uses java 9

Maybe I understand something wrong, but I am confused.

When I run /usr/libexec/java_home -V I get:

9.0.4, x86_64:  "Java SE 9.0.4" /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
1.8.0_161, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home

But running java -version logs:

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

But in eclipse I get a lot of similar build errors. One of them is

(package javax.jws is declared in module java.xml.ws, which is not in the module graph)

Why is Eclipse using java 9 to compile the project? How can I set JAVA 8 to compile the project instead of Java 9?

I have set the java compiler to 1.8 in Eclipse but anyway I get a lot of module errors. Why?

在此处输入图片说明

Right click on your project select build path -> configure build. In the opening window, there is JRE system library entry, edit it to point jdk8.

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