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 javac 1.7.0_55 to compile java sources
Information:java: Errors occurred while compiling module 'Example'
Information:Compilation completed with 1 error and 0 warnings in 3 sec
Information:1 error
Information:0 warnings
Error:java: invalid source release: 8
My guess is that its something related to Java 8 vs Java 7, but I have no idea what specifically. I've tried to Google around for this message, but they either talk about javac
or target release
, so it doesn't exactly seem to apply.
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
inIntelliJ Idea 2017.2.6
because I upgraded the dependency versionMaven
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'.For Grails users, apply these declarations in your BuildConfig.groovy file:
Check your
pom.xml
first (if you have one)Check your module's
JDK
dependancy. Make sure that it is1.8
To do this,go to Project Structure -> SDK's
Add the path to where you have stored 1.8 (
jdk1.8.0_45.jdk
in my case)Apply the changes
Now, go to Project Structure ->Modules
Change the Module SDK to
1.8
Apply the changes
Voila! You're done
Change in
pom.xml
1.6
to1.8