Home >Java >javaTutorial >How Can I Specify a Custom JDK Version for My Gradle JavaFX Builds?
Customizing JDK Version for Gradle Builds
To specify the JDK version for your Gradle application that uses JavaFX, there are two approaches you can consider:
1. Gradle.properties Setting:
Define a variable in your gradle.properties file located in the .gradle directory within your user's home directory. Use the following format:
org.gradle.java.home=<path_to_jdk_directory>
Ensure that the JDK installation path provided in the path_to_jdk_directory matches the version you want.
2. Build.gradle Configuration:
Alternatively, you can override the JDK path for the current build by modifying your build.gradle file. Add the following lines within the compileJava block:
compileJava.options.fork = true compileJava.options.forkOptions.executable = '/path_to_javac'
Replace /path_to_javac with the specific path to the Java compiler from your desired JDK installation. This method only applies the JDK change to the current build process rather than permanently setting it for all Gradle builds.
The above is the detailed content of How Can I Specify a Custom JDK Version for My Gradle JavaFX Builds?. For more information, please follow other related articles on the PHP Chinese website!