how to fix "javac: invalid target release: 1.6" error
For reasons not worth going into, we are still running our project code under Java 1.5, and this has caused no end of interesting scenarios, including today's issue when attempting to run a unit test in debug mode. I received the following error in Compile Messages in IntelliJ (v9, also an involved story):
Information:Usage: javac
I googled the last line of this and got a bunch of recommendations regarding pointing JAVA_HOME at Java 1.6, but because of our constraint that solution is not for us. Also, there was no mismatch between the Java version being used by IntelliJ and that being used by Maven (you can do mvn -version to check).
Finally I discovered that IntelliJ has a hidden little default setting in the compiler that was effing it up. I discovered it via the Maven tab -> properties, but it's just a project setting. I used the top left search field to search for Java. That gives several results, including one for the Java Compiler:
As you can see, there's this secret little config that is the cause of the problem:
Additional command line parameters: -target 1.6
DERP!
When I removed this parameter and reran my debug unit test, everything worked just fine.
2 comments:
Thank you! Had this exact error. Bloody Maven
same here, thanks!
Post a Comment