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
- Open IntelliJ IDEA and go to the main menu.
- Click
File > Project Structure > SDKs. - The SDKs section lists every configured SDK. If the JDK you want is missing, add it.
- Click the
+icon, selectJDK, and browse to the directory where the JDK is installed. IntelliJ validates it and adds it to the list. - 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
- Open the project in IntelliJ IDEA.
- Go to
File > Project Structure > Project. - In the Project SDK section, select an existing SDK from the drop-down, or add a new one the same way as above.
- 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.
- Go to
Run > Edit Configurations. - Select a configuration in the left panel.
- On the
Configurationtab, 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
| Action | Path or Setting | Description |
| Adding a new Global JDK | File > Project Structure > SDKs | Add and select new JDK installations globally. |
| Changing Project JDK | File > Project Structure > Project | Change or select the JDK for the specific project. |
| Configuring Run Configurations | Run > Edit Configurations | Set specific JDK or JRE for different run configurations. |
| Automating SDK Settings | .idea/misc.xml | Specify 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.
Related reading
- How do I check if a file exists in Java?
- How do I check if my EditText fields are empty?
- How do I check if the Java JDK is installed on Mac?
- How do I choose the URL for my Spring Boot webapp?
- How do I clone a generic List in Java?
- How do I Cluster Hibernate ORM Identifiers when using GenerationType.Table
- How do I compare strings in Java?
- How do I configure HikariCP in my Spring Boot app in my application.properties files?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseData 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.