How do I change the IntelliJ IDEA default JDK?
To tweak the default JDK in IntelliJ IDEA, adhere to these quick steps:
- Head to:
File > New Projects Setup > Structure...
and select theProject
tab. - Under
Project SDK
, select your desired JDK orAdd New...
if your JDK isn't already listed.
For JDK 11:
This one-time setup
allows all your forthcoming projects to adopt the selected JDK, saving you from repetitive JDK changes for individual projects.
The settings walkthrough: easy steps
Before 2017.3 - Slight difference
If you're running earlier versions of IntelliJ IDEA (prior to 2017.3), the procedure slightly varies:
- Go through
File > Other Settings > Template Project Structure…
for modifying bothProject SDK
andProject Language Level
.
Stay updated for unhindered operations
To enjoy the latest features and for a seamless JDK switch, keep your IntelliJ IDEA updated. This ensures consistency between your version and the walkthrough here.
The swift blade of IntelliJ - Keyboard shortcuts
Hotkey wizards, use Ctrl+Alt+Shift+S
. This power combo for Project Structure dialog grants quick access to JDK modification settings.
Language level synchronisation - Crucial coupling
To enjoy optimal performance, ensure your Project Language Level aligns with the JDK version. For instance, for Java 8, choose 8 - Lambdas, type annotations etc.
and taste the future of syntax!
Checking your backstage worker - The Compiler
After adjusting the JDK, align your Java compiler settings with it. This ensures effective utilisation of the updated JDK's features and improvements.
Maven or Gradle projects - Special consideration
For projects managed by Maven or Gradle, indicate the JDK in the pom.xml
or respective build file. This helps in keeping the language level consistent and avoiding unnecessary prompts.
Additional setup - New JDK installation
In case you need a JDK version not listed in IntelliJ IDEA's SDK Manager:
- Head to the official Java website or an OpenJDK provider, and download the required version.
- Unpack the JDK to your preferred directory.
- Use IntelliJ IDEA's Guided Setup to register the newly installed JDK.
Troubleshooting tips - Overcoming hiccups
JDK doesn't show up?
Ensure the JDK is correctly added to IntelliJ IDEA by re-navigating to Project Structure > SDKs to manually add the JDK path, if not listed.
Issues with project imports?
Check your project's build tool configurations and IntelliJ IDEA system settings to ensure perfect JDK harmony.
In need of visual aids?
Screenshots shared in existing answers can be a great assistance, serving as a virtual mentor!
Was this article helpful?