Can't compile a java 9 project in IntelliJ IDEA with module-info.
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
One way to add Java 9 modules in IntelliJ IDE is to use IntelliJ specific project modules. Intellij module is an independent and ordinary Java project. To use Java 9 modules, we need to use IntelliJ 1217.1 or later versions. The IDE added various support to develop Java 9 modules.
IntelliJ IDEA had already had a concept of modules: every IntelliJ IDEA module built its own classpath. With the introduction of the new Java platform module system, there appeared two systems of modularity: the IntelliJ IDEA modules, and the new Java 9 modules that are configured using module-info.java.
Select a module or a project you want to compile and from the main menu, select Build | Build Project (Ctrl+F9). IntelliJ IDEA displays the compilation results in the Review compilation and build output.
A module file (the .iml file) is used for keeping module configuration. Modules allow you to combine several technologies and frameworks in one application. In IntelliJ IDEA, you can create several modules for a project and each of them can be responsible for its own framework. For more information, refer to Add frameworks (facets).
It appears to be a new issue caused by Java 9 update 166, I've reported it in YouTrack, please follow for updates:
I am using IntelliJ EAP 2017.2 build 1909.2 and this is not an issue anymore
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With