I am trying to start a new JDK 9 project in IntelliJ, but when I attempt to run it I get the following error during the make process:
Error:java: invalid flag: -release
I know I haven't set it up correctly but can't seem to find anything relating to setting up a project with Jigsaw in IntelliJ.
Edit Here is a screen shot of the issue. Haven't been able to find anything related to this anywhere.
I have no compiler errors in the IDE. It just fails on the build/run command. This is a clean install of IntelliJ, new project started with the JDK 9.
I think this is the bug:
Error:java: invalid flag: -release when compiling using java 9 early access build 135 +
In other words:
I was able to set the JDK level to experimental and it worked.
Hopefully this will help others who run into this issue.
The error message complains about the unrecognized option
-release
. This is a compiler flag that was introduced in Java 9. Are you sure your project is using a JDK 9?What is strange is a detail of the message. This is what I get for
java
andjavac
on different versions:javac -release
~>javac: invalid flag: -release
java -release
~>Unrecognized option: -release
javac -release
~>javac: -release requires an argument
java -release
~>Unrecognized option: -release
I'm unclear how you got
java
(notjavac
) to complain withinvalid flag
.The -release flag is a valid argument for javac but not for java. And in fact if you are building a Java 9 project you don't need it either way. Are you specifying it somewhere? If there is place to specify release in IntelliJ, you can try to turn it off. Also you could post the command IntelliJ is running here, and try to run the command yourself.