I have JDK 7 installed on my machine, but I want to compile against JDK 8 using IntelliJ IDEA.
In the window that opens when choosing Help > About
, there is the following line:
JRE: 1.8.0_51-b16 x86
Well, IDE is running on Java 8. In fact, here it states:
JDK is bundled with all the product installers and it's recommended that you will use the provided JDK version unless there are any specific issues.
That's great! I should be able to use the bundled version with my projects too. But where is that JDK located?
When selecting the home directory for a new project, the default path is C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.1\jre
, but it doesn't work.
The selected directory is not a valid home for JDK
After exploring a bit, I found C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.1\jre\jre\bin
. It contains many files, even some called java.exe
and javaw.exe
, but it doesn't work.
So where is the home directory for the bundled version of the JDK installed with IDEA?
The locations of these folders vary depending on your system, but in all versions of Windows, the JDK root folder is in the path Program Files\Java on your boot drive. The name of the JDK root folder also varies, depending on the Java version you've installed. For version 1.7, the root folder is jdk1.
From the main menu, select Help | Find Action or press Ctrl+Shift+A . Find and select the Choose Boot Java Runtime for the IDE action. Select the new desired runtime and click OK.
If you want to know, where the bundled JDK is, try this:
[Ctrl+Shift+A] within IDEA and type "JDK" and select "Switch IDE Boot JDK"
You should see the bundled directory and you can switch to an other JDK path.
Please be aware that Java 8 is required to run IntelliJ IDEA starting from version 2016 on all the supported platforms.
EDIT:
Starting with version 2019.1:
[Ctrl+Shift+A] within IDEA and type and select "Choose Runtime..." (requires the 'Choose Runtime' Plugin)
Selecting-the-JDK-version-the-IDE-will-run-under
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With