'java: error: release version 17 not supported

I recently updated to Intellij 2021.1. However, whenever I try to run my program, I get:

java: error: release version 17 not supported

I have tried snooping around for other answers, and have found none. It appears my sdk is version 16, if that helps.



Solution 1:[1]

I have faced the same error while trying to use version 16.This is because the new version you are trying to use is unstable.

  1. you have to uninstall the version 17 go to: file -> project structure -> SDKs .delete sdk 17 by right clicking on it and then delete. right click on highlighted version(in your case its 17)

  2. now you have to change project sdk go to: file -> project structure -> project . select the previous version which use to work for you , in my case its 15 java version "15.0.2". set project language level to default (SDK default(15-Text blocks))

    changing project sdk and project language level

  3. the last part is to change the project configuration sdk go to your navigation bar where you debug your project then select edit configurations . select the sdk 16 for your project (in my case its 15) to change the project configuration sdk

Solution 2:[2]

I had the same problem. What helped in my case is the following. In IntelliJ IDEA I opened File -> Project structure and then clicked Modules and changed the Language level to 17. Then I was able to run my code without problems.

Project structure window

Solution 3:[3]

This issue happened to me while upgrading to Java 17, I solved it by configuring the new SDK in project structure and invalidate the caches : File --> invalidate caches --> default selection and restart.

Solution 4:[4]

See this answer for the relevant screenshots. Make sure all the source/target levels are configured correctly in all the dialogs. It may be a typo somewhere and 17 is used instead of 1.7 (Java 7).

Inspect .idea/misc.xml file in the project directory, make sure it specifies the correct versions. See also the language levels specified in *.iml module files and in .idea/compiler.xml file.

Solution 5:[5]

  1. Check that a JDK 17 is available at File -> Project Structure -> Platform Settings -> "SDKS"
    File -> Project Structure -> Platform Settings -> "SDKS"

  2. Select the 17 JDK at File -> Project Structure -> Project Settings -> "Project"
    File -> Project Structure -> Project Settings -> "Project"

  3. File -> Invalidate Caches... -> (leave defaults) -> "Invalidate and Restart"

  4. Do "Build" -> "Rebuild Project"

Solution 6:[6]

In my case, updating .idea/misc.xml didn't help. I was upgrading from Intellij 2020.2 -> Intellij 2020.4 -> Intellij 2020.1.1. Ended up with a reset: File -> Manage IDE Settings -> Restore Default Settings...

Solution 7:[7]

Your error is likely from IntelliJ attempting to call a Java 17 parser for compliance with Java 17 syntax (regardless of the SDK type) and there is no Java 17 JDK installed to perform the syntax checking with. You have 2 options.

Change 'Language Level' (Project Settings / Project in the Module Settings available from context window - right click - in the project window) to match your current SDK (ignoring possible language conflicts with more recent versions)

Download a Java 17 JDK to perform parsing with. That is in Platform Settings/SDKs in the same context menu, select '+', select 'Download JDK', then download and install a Java 17 version.

Solution 8:[8]

There is one more place worth checking -> Java Compiler settings

IntelliJ IDEA Settings

Solution 9:[9]

In order to fix this I had to change the Ant build setting Execution -> Jun under JDK. For some reason the default was JDK 11, everywhere else I has specified JDK 16. Once I set this to JDK 16 the problem went away.

Solution 10:[10]

For similar thing happened when upgrading to java 17. I had it changed everywhere else (suggested by other answers) but in the main maven project .iml file there was still reference to openjdk-16. After manually fixing that to "openjdk-17" it started working well

Solution 11:[11]

For me these had to match...

  1. File | Project Structure | Project | Project SDK

  2. File | Project Structure | Modules | Language level

  3. IntelliJ Idea | Preferences | Build, Exec... | Build Tools | Maven | Importing | JDK for importer

  4. system.properties (file) java.runtime.version=

  5. pom.xml - <java.version>

Solution 12:[12]

I had this issue when I was using the default Ant run. When I switched the project to maven with the maven-compiler-plugin with java version set this issue went away.

Solution 13:[13]

I solved this by lowering language level