简体   繁体   English

libGDX和Eclipse-找不到tools.jar

[英]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 . 我一直在尝试使用libGDX生成Eclipse项目,以便在本教程中使用它。 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. 我正在使用最新版本的Eclipse和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. 我通过Eclipse网站上的安装程序获得了Eclipse的Android版本,并且通过Eclipse获得了Android SDK。 Everything is installed in the default folders. 一切都安装在默认文件夹中。 I've got the most recent versions of both the 32 and 64 bits versions of Java. 我拥有Java的32位和64位版本的最新版本。

Could anyone tell me what I'm doing wrong? 谁能告诉我我在做什么错?

PS. PS。 My question might be similar to this question: What exactly is “tools.jar” in the Android SDK? 我的问题可能类似于以下问题: Android SDK中的“ tools.jar”到底是什么? . However, the answer to that question only applies to Android studio users. 但是,该问题的答案仅适用于Android Studio用户。

Check your installed JDK. 检查您已安装的JDK。

You have to set the system property "java.home" and the environment variable JAVA_HOME to a valid JDK. 您必须将系统属性“ java.home”和环境变量JAVA_HOME设置为有效的JDK。

Check gradle.properties file at the root of your project with the following property: 使用以下属性检查项目根目录下的gradle.properties文件:

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

org.gradle.java.home needs to point to a valid JDK location. org.gradle.java.home需要指向有效的JDK位置。

Without this file, you get the same error (Could not find tools.jar). 没有此文件,您将得到相同的错误(找不到tools.jar)。 With the file present, this is no longer an issue. 在文件存在的情况下,这不再是问题。

只需将这一行添加到gradle.properties

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM