Search code examples
javaandroideclipselibgdx

libGDX and Eclipse - Could not find tools.jar


I've been trying to generate an Eclipse project using libGDX, in order to use it with this tutorial. However, everytime I generate the project I get the error message:

Execution failed for task ':core:compileJava'.
Could not find tools.jar

The images below show the settings I use and the messages I get.

I'm using the most recent version of Eclipse and the Android SDK. I got the Android version of Eclipse through the installation program from the Eclipse website and I got the Android SDK through Eclipse. Everything is installed in the default folders. I've got the most recent versions of both the 32 and 64 bits versions of Java.

Could anyone tell me what I'm doing wrong?

PS. My question might be similar to this question: What exactly is “tools.jar” in the Android SDK?. However, the answer to that question only applies to Android studio users.


Solution

  • Check your installed JDK.

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

    Check gradle.properties file at the root of your 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, you get the same error (Could not find tools.jar). With the file present, this is no longer an issue.