Gradle JVM selection
You can check a process of how IntelliJ IDEA selects the Gradle JVM version for installation when you create, open, or link a Gradle project.
Resolve the Gradle JVM version
IntelliJ IDEA executes the following steps one by one and installs Gradle JVM comparing the Java and Gradle supported versions. If IntelliJ IDEA can't achieve a positive result in the first step, it executes the second step, third, and so on until the correct Gradle JVM version is set.
- If you manually added Gradle JVM in Gradle JVM option.
If IntelliJ IDEA doesn't find JDK in the specified location, it executes the next step.
, then this is the first place IntelliJ IDEA looks in and uses the JDK version specified in the - IntelliJ IDEA searches for the JDK version specified in the Project JDK option in . If JDK is found, IntelliJ IDEA verifies that the found JDK version is compatible with the Gradle version and sets Gradle JVM.
If IntelliJ IDEA doesn't find JDK in the specified location, it executes the next step.
- IntelliJ IDEA searches for the default project JDK version in the Project SDK option located in . If JDK is found, IntelliJ IDEA verifies that the found JDK version is compatible with the Gradle version and sets Gradle JVM.
If IntelliJ IDEA doesn't find JDK in the specified location, it executes the next step.
- IntelliJ IDEA searches for the configured JDK with maximum supported version in the SDKs option located in . If JDK is found, IntelliJ IDEA verifies that the found JDK version is compatible with the Gradle version and sets Gradle JVM.
If IntelliJ IDEA doesn't find JDK in the specified location, it executes the next step.
- IntelliJ IDEA searches for the JDK version defined in the JAVA_HOME environment variable. If JDK is found, IntelliJ IDEA verifies that the found JDK version is compatible with the Gradle version and sets Gradle JVM.
If IntelliJ IDEA doesn't find JDK in the specified location, it executes the next step.
IntelliJ IDEA searches for the JDK version in the common installation location in your file system. If JDK is found, IntelliJ IDEA verifies that the found JDK version is compatible with the Gradle version and sets Gradle JVM.
Gradle and Java supported versions
Gradle version | Java version |
---|---|
5.4.1+ | 1.8 - 12 |
5.0+ | 1.8 - 11 |
4.1+ | 1.7 - 9 |
4.0+ | 1.7 - 8 |
earlier | 1.6 - 1.8 |