Java Gradle 找不到 tools.jar
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31989122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Gradle Could not find tools.jar
提问by Fishy
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/845kyxand here is a the full debug error: http://pastebin.com/ugdfySg1Now 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.
我正在尝试使用 LibGdx 制作游戏。我喜欢它!它非常简单,而且比 JME3 和 LWJGL 好很多。但是尝试打包时出现错误。这是 Gradle 的 gui 图像:http: //prntscr.com/845kyx,这是完整的调试错误:http: //pastebin.com/ugdfySg1现在我不知道如何调试这些错误以及什么没有,所以我希望有人可以提供帮助。我还尝试重新创建整个项目,并使其成为 Eclipse 有效项目,而不仅仅是 Gradle。这些都没有奏效。
采纳答案by sglahn
You have to set the system property "java.home" and the environment variable JAVA_HOME to a valid JDK.
您必须将系统属性“java.home”和环境变量 JAVA_HOME 设置为有效的 JDK。
To set the environment variable run:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
要设置环境变量运行:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
回答by infiniteloop
sudo apt-get install openjdk-7-jdk
Fixed it for me for a Jenkins job.
为我的 Jenkins 工作修复了它。
回答by Philippe
I have a file called gradle.properties
at the root of my 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, I get the same error (Could not find tools.jar). With the file present, this is no longer an issue.
如果没有这个文件,我会得到同样的错误(找不到 tools.jar)。有了文件,这不再是问题。
回答by Rohlik
For me was solution this:
对我来说是这样的解决方案:
yum install java-1.8.0-openjdk-devel
Or for newer CentOS/Fedora/RHEL versions:
或者对于较新的 CentOS/Fedora/RHEL 版本:
dnf install java-devel
回答by BODAND
If we already have a lot of different distro answers I might as well add the Arch answer:
如果我们已经有很多不同的发行版答案,我不妨添加 Arch 答案:
sudo pacman -S jdk8-openjdk