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.

- 1,275
- 1
- 12
- 26
-
Can you please include the screenshots and error log in your post? – dunni Aug 13 '15 at 13:08
-
I did they are at the links http://prntscr.com/845kyx and http://pastebin.com/ugdfySg1 – Fishy Aug 13 '15 at 13:09
-
I meant if you could include them directly, not as links. If these services are defunct, your question and the answers become useless for others with the same problem. – dunni Aug 13 '15 at 13:19
6 Answers
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.

- 4,088
- 4
- 44
- 49
-
3
-
@MarkusL your statement is correct. Each developer must create his or her own gradle.properties. The file is not intended for sharing. – Philippe Jul 20 '16 at 13:19
-
this worked for me when i set it to this in the gradle.properties ```org.gradle.java.home=/usr/lib/jvm/default-java/``` – Martin Naughton Sep 10 '20 at 18:53
For me was solution this:
yum install java-1.8.0-openjdk-devel
Or for newer CentOS/Fedora/RHEL versions:
dnf install java-devel

- 2,774
- 1
- 19
- 23

- 1,286
- 19
- 28
-
4For me that works in Fedora 24+: `sudo dnf install java-1.8.0-openjdk-devel` – joseluisq Apr 07 '17 at 14:19
-
1Faced same issue while I was trying to install voldemort kv store on centos 7.2 yum install java-1.8.0-openjdk-devel solved for me – Carbonrock Jun 19 '17 at 08:27
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
-
9i think you can elaborate this answer, like how to set system property in linux etc – iamsaksham Apr 23 '17 at 07:13
-
Also add the following command: `export PATH="${PATH}:${JAVA_HOME}/bin"` – Loich Aug 04 '21 at 22:40
sudo apt-get install openjdk-7-jdk
Fixed it for me for a Jenkins job.

- 5,179
- 10
- 35
- 56

- 135
- 2
- 6
-
13
-
1At least in Ubuntu Xenial package `openjdk-8-jdk-headless` provides `/usr/lib/jvm/java-8-openjdk-amd64/lib/tools.jar` – vesperto Nov 30 '20 at 10:27
-
On my WSL only `openjdk-8-jdk` has tools.jar ,`openjdk-8-jdk-headless` doesn't work. – Tamaki Sakura Aug 15 '23 at 17:55
If we already have a lot of different distro answers I might as well add the Arch answer:
sudo pacman -S jdk8-openjdk

- 117
- 3
- 8
This works for me as a temporary solution. At the root of my project in "gradle.properties" file I have line:
org.gradle.java.home=/usr/lib/jvm/default-java/

- 740
- 6
- 12