Gradle Could not find tools.jar

You have to set the system property "java.home" and the environment variable JAVA_HOME to a valid JDK.

To set the environment variable run: export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64


For me was solution this:

yum install java-1.8.0-openjdk-devel

Or for newer CentOS/Fedora/RHEL versions:

dnf install java-devel

I have a file called gradle.properties at the root of my project with the following property:

org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_74

org.gradle.java.home needs to point to a valid JDK location.

Without this file, I get the same error (Could not find tools.jar). With the file present, this is no longer an issue.