I installed Gradle 2.7 in my C:\ directory for Windows 7.
Created a gradle.properties file in the Gradle directory containing the following:
org.gradle.java.home = “c:\Program Files\Java\jdk1.7.0_03”
Include the following the in gradle build file: apply plugin: “java”
When I run “gradle assemble” from the directory containing the build file, I get the following:
> Execution failed for task ‘:compileJava’.
> Could not find tools.jar
I confirmed that the tools.jar file is in the jdk1.7.0.0_03/lib directory.
When i run “gradle tasks” I dont get any extra tasks that should be available with the java plugin.
I would appreciate any suggestions regarding what else I can do to get the gradle build to recognize the tools.jar file?
Ok, not sure what to make of it. I tried leaving out the quotes but get same error.
I seem to be following the info in the suggested thread.
I don’t have an environment variable set for JAVA_HOME, but would think this is unnecessary
as I am declaring the java location in the properties file. Or do i need it?
I forgot to state in my original text that I am running the gradle build from a Git Bash window.
Well, I added a JAVA_HOME env variable and it is working!
I was wrong in assuming that just adding an "org.gradle.java.home"
to gradle.properties file in the gradle directory would be enough.
Thanks!
Just for clarity, is setting ‘org.gradle.java.home’ to the location of jdk in gradle.properties an alternative to adding the environment variable JAVA_HOME?
Also, my gradle install is in c:\gradle-2.7 directory. This is where i added the gradle.properties file. Is this the correct location or should the file be in the local build directory?
**1. Is setting 'org.gradle.java.home' to the location of jdk in gradle.properties an alternative to adding the environment variable JAVA_HOME?**
Yes. Gradle will first look for the environment variable JAVA_HOME and if defined, use it .
If JAVA_HOME is not found, it will look at the value in gradle.properties.
**2. My gradle install is in c:\gradle-2.7 directory. This is where i added the gradle.properties file. Is this the correct location or should the file be in the local build directory?**
Neither. The gradle.properties file looked up by gradle is located in the users home directory, in the .gradle subdirectory. (eg. c:/users/me/.gradle/gradle.properties).
**3. Should the format of my property be : org.gradle.java.home = "c:\Program Files\Java\jdk1.7.0_03" ?**
No. As stated in the earlier replies it should be without quotes and using forward slashes:
org.gradle.java.home = c:/Program Files/Java/jdk1.7.0_03
Following properties files specification a colon is also a separator sign (like =). So it must be quoted in property values. A valid configuration entry in gradle.properties is: org.gradle.java.home = c\:/Program Files/Java/jdk1.7.0_03
Note the backslash in front of the colon of the drive letter.
Hi,
Build fails on CentOS7.
JDK8 is installed.
Could you tell me a good measures?
$ ./gradlew clean build -xtest
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:compileJava’.
Could not find tools.jar. Please check that /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64/jre contains a valid JDK installation.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[shimatani@bslpc168 ~/dataset-generator]$./gradlew clean build -xtest
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details