javaintellij-ideasdkjava-21

Can't use latest Java Version (JDK 21) in IntelliJ IDEA


I'm using macOS and I want to try Java 21 in IntelliJ IDEA. I believe I have done all the required steps to change Java version of a project / module. Nevertheless I still can't use new Java 21 Features, such as String Templates. How to be able to use Java 21 in IntelliJ?

enter image description here

I have changed:


Solution

  • I needed to update Intellij version to 2023.2.2 and change Language level (File -> Project structure -> project -> language level) to 21 (preview)

    language level 21 (preview) The new language level won't show up until Intellij is updated to the latest version.

    To update Intellij, I needed to manually check for new update

    Manually updating Intellij on Mac

    Intellij IDEA | Check for Updates

    enter image description here

    Manually updating Intellij on Windows / Linux

    File | Settings | Appearance & Behavior | System Settings | Updates

    enter image description here