I've got the same issue as stated by Gryu. Same Intellij 2018 3.3
I was able to start my project by setting (like stated by Grigoriy)
File->Project Structure->Modules ->> Language level to 8 ( my maven project was set to 1.8 java)
AND
File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler -> 8 also there
I hope it would be useful
To resolve this issue I've changed File->Project Structure->Modules ->> Language level to 10.
And check File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler ->> Project bytecode and Per-module bytecode versions. I have 11 there.
Now I don't get these notifications and the error.
It could be useful for someone like me, having the most recent Idea and getting the same error.
1 of the 2 methods will fix the problem:
Method 1 (recommended)
Specify the Java version in your build file.
E.g., For Gradle, go to build.gradle file and specify the source and target compatability like mentioned in the docs and click on the refresh button in the Gradle tool window.
For example, to set source and target compatability to Java version 17:
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
Method 2
If building a project through a build system (Maven, Gradle etc..) works but IntelliJ show Invalid target release
error, then do the following,
Close IntelliJ
Go to the directory of the project
Delete the .idea/ directory
Start IntelliJ with the project's directory
This will re-create the .idea/ directory and will no longer show the error.
NOTE: Any repository specific IntelliJ settings that you have added would be deleted when the .idea/ directory is deleted and they will be re-created with the defaults.
Below changes worked for me and hope the same works for you.
Change the version of Java from 11 to 8 in pom.xml file
<java.version>1.8</java.version>
Go to, File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler
Here, in Module column you can see your project listed and in Target bytecode version column, Java version for the project is already specified(mostly 11), change it to 8
Go to, File -> Project Structure -> Modules. Here, in Source tab, you can see Language level option, choose 8 - Lambdas, type annotations etc.. Finally, choose Apply and OK, you're good to go.
Please update to IntelliJ IDEA 2018.x to get Java 11 support. Your IntelliJ IDEA version was released before Java 11 and doesn't support this Java version.
January 6th, 2021
This is what worked for me.
Go to File -> Project Structure and select the "Dependencies" tab on the right panel of the window. Then change the "Module SDK" using the drop-down like this. Then apply changes.
There is also the possibility of Maven using a different version of JDK, in that case you can set Maven to use the project default JDK version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With