Problem
Compilation fails when using the --add-modules flag while building a Java project with JDK 8 in IntelliJ IDEA.
Environment
- IntelliJ IDEA
- JDK 8
- Java project configured with the
--add-modulescompilation option
Cause
The --add-modules flag is not supported in JDK 8.
The module system was introduced in Java 9, so JDK 8 does not recognize this flag and fails the build.
Resolution / Workaround
-
Option 1: If modular configuration is not needed, remove the
--add-modulesflag from the compilation options. - Option 2: If modular features are required, switch the project to JDK 9 or newer that supports the module system.
Additional Information
- Ensure that your build configuration matches the features supported by the Java version in use.
- Reference: Java --add-modules Documentation
Comments
0 comments
Please sign in to leave a comment.