Error:java: invalid source release: 8 in Intellij. What does it mean?
I had the same issue when "downgrading" a project from Java 8 to Java 6. The reason was that it was not changed at all places in IntelliJ.
In IntelliJ 13.1.4 I had to change Java and SDK version on the following places not to get this error:
- File -> Project Structure -> Project Settings
- File ->
Project Structure -> Module Settings -> Tab: Sources: Language Level - File -> Project
Structure -> Module Settings -> Tab: Dependencies: Module SDK - File -> Settings -> Compiler -> Java Compiler -> Target bytecode
version
The last bullet was the one that was not updated in my case. Once I changed this, the error disappeared.
intellij idea - Error: java: invalid source release 1.9
Select the project, then File > ProjectStructure > ProjectSettings > Modules -> sources
You probably have the Language Level set at 9:
Just change it to 8 (or whatever you need) and you're set to go.
Also, check the same Language Level settings mentioned above, under Project Settings > Project
IntelliJ - Invalid source release: 17
In intellij just set Gradle JVM to Java version 17.
"File -> Settings.. -> Build, Execution, Deployment -> Build Tools -> Gradle"
there select your project and set Gradle JVM to your java 17.0.1
Error: Java: invalid target release: 11 - IntelliJ IDEA
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
Error:java: error: invalid source release: 13 using JDK12 with IntelliJ
The right way™
The earliest version of IntelliJ that supports switch expressions is version 2019.1, which was released on March 27, 2019. You can get it here: https://www.jetbrains.com/idea/download . You also need JDK 12 of course, and set that as your project SDK.
Then you can set the language level to:
12 (Preview) - Switch expressions
With that, everything should work.
If it doesn't, you might want to check that You've;
- set the project language level, as well as the module language level to the "12 (Preview)"
- set the execution JRE in the run configuration of your application to 12 (or the default, which is the project SDK).
- set the right bytecode version in Settings -> 'Build, Execution, Deployment'/Compiler/Java Compiler. (Leave this fields empty to match the language level)
Manually configure --enable-preview (no intellisense)
Turning my comment into an answer. You can add the --enable-preview
flag to the VM by going to:
Run -> Edit Configurations...
Then selecting your main class from the tree menu on the left, and pasting --enable-preview
in the "VM options" box
You can do the same for the compiler by going to:
File -> Settings...
Then in the tree menu under Build, Execution, Deployment -> Compiler -> Java Compiler you can put --enable-preview
in the "Additional command line parameters" box:
Note that intellisense still might not work after doing that. I'm still seeing red squiggly lines under the ->
s with the error message "unexpected token". But, when I click the run button the class compiles and runs just fine.
IntelliJ 2021.2.2 gives error 'java: error: invalid source release: 18' when compiling program
.idea/misc.xml
has incorrect language level specified for some reason (JDK_X
):
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="16" project-jdk-type="JavaSDK">
Close the project, change languageLevel
to 16
and see if it helps.
There was a related bug reported, but it should be fixed in IntelliJ IDEA 2020.2 and later versions. Probably a regression.
Java 11 : Error:java: invalid source release: 11 - Not sure what to do anymore
Please check your JDK 11 Setup in IntelliJ! Even though the project SDK is called 11, it still says that your java-version is 1.8.161. Judging from this it looks like your new jdk 11 still points to your old 1.8 installation which does not now about version 11 yet.
Related Topics
How to Create a Project from Existing Source in Eclipse and Then Find It
Visual Studio Code, Java Extension, How to Add a Jar to Classpath
Hibernate Sessionfactory VS. JPA Entitymanagerfactory
Java.Util.Date to Xmlgregoriancalendar
Is It Safe to Get Values from a Java.Util.Hashmap from Multiple Threads (No Modification)
Injecting Beans into a Class Outside the Spring Managed Context
Why Does My Spring Boot App Always Shutdown Immediately After Starting
How to Deserialize the Object, If It Was Moved to Another Package or Renamed
Hash String via Sha-256 in Java
How to Get Client Information Such as Os and Browser
How to Manually Set an Authenticated User in Spring Security/Springmvc
Filter Java Stream to 1 and Only 1 Element
Intellij Cannot Resolve Symbol on Import
How to Deserialize Js Date Using Jackson
Java Method Invocation VS Using a Variable
Which Annotation Should I Use: @Idclass or @Embeddedid
How to Check the Bitness of My Os Using Java? (J2Se, Not Os.Arch)