Im trying to compile some code in I\'m using Intellij Ultimate 13.1.4, but I get the following error and I have no idea what it means:
Information:Using java
I checked all above said project version, module version, project bytecode version, target bytecode version settings in IntelliJ Idea
, but all were the same as I scratched.
I face this error Error:java: invalid source release: 1.8
in IntelliJ Idea 2017.2.6
because I upgraded the dependency version Maven
pom file, which(dependency) were supposed to build for JDK 1.8 application and I were building my application on and with maven compiler source and target JDK 1.7.
Hence I again downgrade the dependency version to earlier one in Maven
pom, and the error gone after project Rebuild Module 'xyz_project'.
Lots of good answers. For those using the (almost) latest version of Intellij, at the time of writing, what can be said, is that the project JDK can be at a higher level, than that of the module. In fact without it, Maven will have to be rolled back to an older version. Therefore with the following version of Intellij:
One should not change the project level JDK and therefore be able to leverage the Maven or Gradle settings when building, but when running Maven or running Gradle using a more modern version of the JDK. If you lower your project level JDK from say JKD8 to JDK6, Maven or Gradle will not run.
Keeping your module at a lower level JDK-wise will enable you to build it to that version, if you use the Module rebuild or build options; using the menu options for rebuilding the project will complain wit "Invalid source release:8...".
Change in pom.xml
1.6
to 1.8
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
I had the same issue the solution for me was to change my java version in the pom.xml file.
I changed it from 11 to 8.
If you are using Gradle as a build tool and you get this error when executing a Gradle task i.e TomcatRun take a look to my other answer to the same question
javac: invalid target release: 1.8
It can be simply overcome by setting on Project Structure
. You just need to select the right path for related version of JDK. Select new
on dependencies tab, and choose the path. It's done!