How to change java version in intellij

In this post, we will see how to change java version in intellij.

Steps to change java version in intellij IDEA

Here are steps to change java version in Intellij
idea.

  1. Go to File -> Project Structure

If you prefer keyboard shortcuts:

  • Windows: Ctrl + Shift + Alt + S
  • Mac: CMD + ;

Following pop up will be displayed in intellij.

Project Structure
  1. Navigate to Project Setting -> SDK and add JDK.
    Add JDK

    If you have already configured JDK, then select the JDK.

  2. Go to Project Settings -> Project and change Project SDK and Project language level to previously added java version
    ChangeProjectSDK

    Once you change the JDK version, project will start reindexing its source files and libraries to ensure all JDK features are in sync.

  3. Naviage to Project Settings -> Project and change
    Change module SDK

💡 Did you know?

Please note that when you change java version in intellij, it will only be used by intellij. If you run the java program via command line, then it will use JAVA_HOME java version.

It won’t also change JVM used by build tools such as maven or gradle.

That’s all about how to change java version in intellij.

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *