I can't figure out to get this working.
Scenario:
What I want
I thought about having the gradle.properties
file, defining the variable. Something like
JAVA_HOME_FOR_MY_PROJECT=<path to my desired JDK>
What I don't want
JAVA_HOME
to the desired JDKI could live with many suggestions:
use JAVA_HOME=<my special JDK path defined somewhere else defined>
)Question:
gradle.properties
, system environment variable, ...) to the build process?I have more than one JDK7 available and need to point to a special version (minimum JDK_u version).
Any answer is appreciated and I'm thankful for every hint to the right direction.
Right click on the deploy or any other task and select "Open Gradle Run Configuration..." Then navigate to "Java Home" and paste your desired java path. Please note that, bin will be added by the gradle task itself.
By default, Gradle uses the java version from the JAVA_HOME environment variable path configured in the machine, and JAVA_HOME points to JDK installed on the machine. For example, the machine is installed with the JDK 1.8 version and the Gradle project needs a java 11 version.
Access the Gradle JVM settingsIn the Settings/Preferences dialog ( Ctrl+Alt+S ), select Build, Execution, Deployment | Build Tools | Gradle. On the Gradle settings page, under the Gradle section, use the Gradle JVM option to check the Gradle version used for importing a project.
You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or by editing the Gradle distribution reference in the gradle/wrapper/gradle-wrapper. properties file.
Two ways
gradle.properties
in the .gradle
directory in your HOME_DIRECTORY
set org.gradle.java.home=/path_to_jdk_directory
or:
In your build.gradle
compileJava.options.fork = true compileJava.options.forkOptions.executable = '/path_to_javac'
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