[英]Could not find tools.jar when build gradle project
I try build gradle project and get error: 我尝试构建gradle项目并获得错误:
Could not find tools.jar.
找不到tools.jar。 Please check that C:\\Program Files\\Java\\jre1.8.0_144 contains a valid JDK installation.
请检查C:\\ Program Files \\ Java \\ jre1.8.0_144是否包含有效的JDK安装。
I add to path
我添加到
path
C:\Program Files\Java\jdk1.8.0_112\bin
C:\Program Files\Java\jre1.8.0_144\bin
when I write java and javac in console all works. 当我在控制台中编写java和javac时都能正常工作。 But project not build
但项目没有建立
The reason it works in your console is because your console is most likely picking up its JDK from your JAVA_HOME value in your environment settings. 它在您的控制台中工作的原因是因为您的控制台很可能从您的环境设置中的JAVA_HOME值中获取其JDK。
For Gradle, you need to create a gradle.properties file in your application's root directory (if it does not already exist) and add the following line: 对于Gradle,您需要在应用程序的根目录中创建一个gradle.properties文件(如果它尚不存在)并添加以下行:
org.gradle.java.home=C:/path/to/your/jdk
When you copy your path from the Windows Explorer, please remember to change "\\" to "/", otherwise, they will be escaped and you will receive an error inside of Eclipse. 当您从Windows资源管理器中复制路径时,请记住将“\\”更改为“/”,否则它们将被转义,您将在Eclipse中收到错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.