Gradle Could not find tools.jar

56,631

Solution 1

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

Solution 2

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.

Solution 3

For me was solution this:

yum install java-1.8.0-openjdk-devel

Or for newer CentOS/Fedora/RHEL versions:

dnf install java-devel

Solution 4

sudo apt-get install openjdk-7-jdk

Fixed it for me for a Jenkins job.

Solution 5

If we already have a lot of different distro answers I might as well add the Arch answer:

sudo pacman -S jdk8-openjdk
Share:
56,631
Fishy
Author by

Fishy

A gamer that just happens to be able to write code.

Updated on July 06, 2021

Comments

  • Fishy
    Fishy almost 3 years

    I am trying to make a game with LibGdx. I love it! It is sooo simple and a lot better than JME3 and LWJGL. But trying to package it I am having an error. Here is an image of the gui for Gradle: http://prntscr.com/845kyx and here is a the full debug error: http://pastebin.com/ugdfySg1 Now I don't know how to debug those errors and what not, so I hope someone can help. I have also tried to re-create the entire project, and make it a eclipse valid project, instead of just Gradle. None of that worked. enter image description here