Gradle 找不到 tools.jar [英] Gradle does not find tools.jar
问题描述
我正在使用带有 gradle 的 javadoc doclets,所以我需要使用包 tools.jar,它位于 jdk 的 lib 文件夹中(在我的例子中是 1.6.0_26).
I am using javadoc doclets with gradle, so I need to use the package tools.jar, which is in the lib folder from the jdk (1.6.0_26 in my case).
关键是 gradle 不会自动获取它,所以我将该工具包添加到我的 libs 文件夹,然后将其添加到 dependencies.gradle .
The point is that gradle does not take it automatically, so I was adding that tools package to my libs folder, and then adding it to dependencies.gradle .
现在我想将它直接从我的 JDK 主目录中取出到我的 dependencies.gradle 中.有没有办法做到这一点?我在我的 dependencies.gradle 中尝试了下一个:
Now I want to take it directly from my JDK home into my dependencies.gradle. Is there a way to do that? I have tried the next in my dependencies.gradle:
compile files("${System.properties['java.home']}/lib/tools.jar")
但是编译的时候没有找到.
But it does not find it while compiling.
推荐答案
找到了.系统属性 'java.home' 不是 JAVA_HOME 环境变量. JAVA_HOME 指向 JDK,而 java.home 指向 JRE.有关详细信息,请参阅该页面.
Found it. System property 'java.home' is not JAVA_HOME environment variable. JAVA_HOME points to the JDK, while java.home points to the JRE. See that page for more info.
Soo...我的问题是我的起点是 jre 文件夹(C:jdk1.6.0_26jre)而不是我认为的 jdk 文件夹(C:jdk1.6.0_26)(tools.jar 是在 C:jdk1.6.0_26lib 文件夹中).dependencies.gradle 中的编译行应该是:
Soo... My problem was that my startpoint was the jre folder (C:jdk1.6.0_26jre) and not the jdk folder (C:jdk1.6.0_26) as I thought(tools.jar is on the C:jdk1.6.0_26lib folder ). The compile line in dependencies.gradle should be:
compile files("${System.properties['java.home']}/../lib/tools.jar")
这篇关于Gradle 找不到 tools.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!