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:
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.
-
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)
-
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
-
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:
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 3:
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.
Solution 4:
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 5:
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.