Home >Java >javaTutorial >How Can I Specify a Custom JDK for My Gradle Project?
Gradle: Specifying Custom JDK
In a scenario where your Gradle application utilizes JavaFX and you require a specific JDK version, this guide will provide different approaches to specify the desired JDK.
Approach 1: Gradle.properties Variable
Define the variable org.gradle.java.home as follows:
org.gradle.java.home=/path_to_jdk_directory
Approach 2: Build.gradle Configuration
In your build.gradle file, add the following lines:
compileJava.options.fork = true compileJava.options.forkOptions.executable = '/path_to_javac'
Other Options
Override the JAVA_HOME environment variable for the build context using the following syntax:
JAVA_HOME=/my_special_jdk_path
The above is the detailed content of How Can I Specify a Custom JDK for My Gradle Project?. For more information, please follow other related articles on the PHP Chinese website!