问题
Can't compile a java 9 project in IntelliJ IDEA with module-info.
- Create a project
- Add module
- Create a class with with a main (without module-info.java it runs)
- Add Module-info.java
- Run Main Fails
Configuration
Module-info
module httpexample {
}
Error
Error:(1, 1) java: file should be on source path, or on patch path for module
Intellij Version
IntelliJ IDEA 2017.1.2
Build #IU-171.4249.39, built on April 25, 2017
JRE: 1.8.0_112-release-736-b16 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.11.1
回答1:
It appears to be a new issue caused by Java 9 update 166, I've reported it in YouTrack, please follow for updates:
- IDEA-172212 Compile Error under JDK9-167
回答2:
I am using IntelliJ EAP 2017.2 build 1909.2 and this is not an issue anymore
回答3:
I have installed IntelliJ 2017.2 EAP and JDK 9 build 169 and opened my module system projects and it works fine, now my system info is:
IntelliJ IDEA 2017.2 EAP
Build #IU-172.2103.15, built on May 12, 2017
IntelliJ IDEA EAP User
Expiration date: June 11, 2017
JRE: 1.8.0_152-release-845-b3 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.4
来源:https://stackoverflow.com/questions/43722565/cant-compile-a-java-9-project-in-intellij-idea-with-module-info