Error:java: error: invalid source release: 13 using JDK12 with IntelliJ

error:java: invalid source release: 12
error: java error: release version 12 not supported intellij
java error java invalid source release 8
invalid source release java 8
maven invalid source release 8
invalid source release: 1.8 gradle
error:java: error: release version 5 not supported
java sdk invalid

I am trying to build a project with JDK-12 ea. While trying to execute a sample class:

public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int value = scanner.nextInt();
    // After JEP-325
    switch (value) {
        case 1 ->System.out.println("one");
        case 2 ->System.out.println("two");
        default ->System.out.println("many");
    }
} 

The IDE throws the error that reads

Error:java: error: invalid source release: 13

Relevant project configuration screens :

Module settings

SDKs

Compiler settings

About IDE:

IntelliJ IDEA 2018.3.3 (Community Edition)
Build #IC-183.5153.38, built on January 9, 2019
JRE: 1.8.0_152-release-1343-b26 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

Tried switching back the language level to 12, without experimental features, but it ends in

I remember using the experimental features in recent past(not sure of exact IntelliJ version) successfully. Has something changed that I need to configure apart from this as well?

java: invalid source release: - Easy tutorial to fix the error, Step by step tutorials to solve the java: invalid source release: 8 error on IntelliJ. This article tend to correct the project/module Java version  Error: Java: invalid target release: 11 - IntelliJ IDEA 24 Unable to compile using Java 1.7 in Jetbrains Intellij after moving from 1.6 to 1.7 (maven based project)

In IDEA v2018.3.2 Preview language level added --enable-preview parameter to command line. In v2018.3.3 there is no 12 Preview level, so parameter has to be added manually as you correctly mentioned in your comment. Experimental features doesn't add any compilation parameters.

Error:java: error: invalid source release: 13 using JDK12 with IntelliJ , I'm using Java 14, and I get this error message when I try to run my program : Error:java: error: release version 15 not supported I.. There is no public release for Java 15 yet, so you can't target it. I tried running again, and still get Error:​java: error: invalid source release: 15 Created May 03, 2020 13:23. To fix this, open up .idea/compiler.xml and change the “target” parameter to the release that you’re targeting. Your build should now compile just fine. Er, without that error, at least :-). Updated: November 03, 2017. Twitter Facebook Google+ LinkedIn Previous Next

Just for the record. I was having similar error but with Java 14:

Error:java: error: invalid source release: 14

What solved the problem for me was to hunt down on every single place of the IDE where there was another Java version being mentioned that wasn't the 14th one.

The places that I had to change were:

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.

After updating to 2020.1, I can't run my programs (Error:java: error , After moving our compile target to Java 1.8 I'm getting an error Information:​Using javac 1.8.0_45 Error:java: invalid source release: 1.8. 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

Build project failing – IDEs Support (IntelliJ Platform), I spent way too much time trying to work out why IntelliJ was crying so much Easy Fix - Error Duration: 2:05 Posted: Nov 25, 2019 Error: java: invalid source release: 8 The reason is that your project/module JDK version does not match the intellij project version and below steps to fix it : Open your IntelliJ and navigate to File -> Project Structure -> Project Settings (Ctrl + Alt + Shift + S)

Easy Fix - Error: Java: invalid target release: 11, Setting the Java Version in Maven, Learn how to use the Maven compiler little further Error:java: error: invalid source release: 13 using JDK12 with IntelliJ Hot  You can see that the Maven in my machine was using JDK 1.6.0_37, and that's why, when I was building my Maven project with JDK 1.7 as the target, it was failing.. Once I updated the pom.xml to use

Unable to compile simple Java 10 / Java 11 project with Maven, Programming‎ > ‎IDE‎ > ‎IntelliJ‎ > ‎. Error:java: invalid source release: 9. cause: java language level does not match installed Java version; File -> Project  Check your pom.xml first (if you have one) Check your module’s JDK dependancy. Make sure that it is 1.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)

Comments
  • I guess experimental features uses --source 13 ? Have you tried with the --enable-preview flag?
  • "12 (preview)" language level ... yup that seems to be missing from the IntelliJ for me now. Adding compiler level flag does work. (you can make that as an answer) but that doesn't relate either to the error that IntelliJ stated or even that the actual error was displayed against java and not javac!
  • The error in intellij seems to come from javac. If I select "12 (preview)" as a language level in the "Messages" I see on the last 2 lines "...Compilation completed with 1 error...", "Error:java: error: release version 12 not supported", and the error is the same as the one I get when using --release 12 with javac. intellij saying 'java' is talking about the used language I guess... Also, I'm not sure why you don't have "12 (preview)" as a language level, since you seem to have a newer version of intellij than me...
  • @JornVernee True, its(the error) for compiling sources in "java". Yes, I have the recent most IntelliJ.
  • FWIW I updated to 2018.3.3 and the "12 (preview)" language level has been removed, though I am asked to accept the preview license when selecting "12". I guess they'd rather have users manually specify the --enable-preview flag.
  • How do I keep maven from switching module language level from 12 (Preview) to 12. I have compilerArgs --enable-preview on maven-compiler-plugin.