IntelliJ IDEA
JDK
Java Development Kit
Programming
Software Configuration

How to change the JDK in IntelliJ IDEA

Codemia Knowledge Hub ·

Register the JDK under File > Project Structure > SDKs, then select it as the Project SDK under File > Project Structure > Project. IntelliJ may use a bundled JDK by default, but projects often need a specific version for compatibility or language features.

IntelliJ configures JDKs at two levels. The global JDK applies to every project that does not define its own. A project-level JDK overrides it for that project only, without touching other projects or global settings.

Adding a JDK globally

  1. Open IntelliJ IDEA and go to the main menu.
  2. Click File > Project Structure > SDKs.
  3. The SDKs section lists every configured SDK. If the JDK you want is missing, add it.
  4. Click the + icon, select JDK, and browse to the directory where the JDK is installed. IntelliJ validates it and adds it to the list.
  5. You can then select it for any project, or make it the default SDK by using it in project settings.

Changing the JDK for one project

  1. Open the project in IntelliJ IDEA.
  2. Go to File > Project Structure > Project.
  3. In the Project SDK section, select an existing SDK from the drop-down, or add a new one the same way as above.
  4. Apply the changes. The project now compiles and runs with that JDK.

Choosing the JRE for a run/debug configuration

Each run/debug configuration can specify its own JDK or JRE, which helps when testing compatibility with different Java versions.

  1. Go to Run > Edit Configurations.
  2. Select a configuration in the left panel.
  3. On the Configuration tab, choose the JRE you want.

Project JDK in .idea/misc.xml

IntelliJ stores the project-level JDK in the misc.xml file inside the project's .idea folder, which helps keep environment settings consistent across machines.

Quick reference

ActionPath or SettingDescription
Adding a new Global JDKFile > Project Structure > SDKsAdd and select new JDK installations globally.
Changing Project JDKFile > Project Structure > ProjectChange or select the JDK for the specific project.
Configuring Run ConfigurationsRun > Edit ConfigurationsSet specific JDK or JRE for different run configurations.
Automating SDK Settings.idea/misc.xmlSpecify JDK settings in project files for consistency across setups.

A newer JDK can bring better performance and more features, but it can also break older applications, so test thoroughly after switching.


Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms