Gradle没有找到tools.jar [英] Gradle does not find tools.jar

查看:932
本文介绍了Gradle没有找到tools.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用javadoc doclet和gradle,所以我需要使用tools.jar包,它位于jdk的lib文件夹(我的例子中为1.6.0_26)。



关键在于Gradle不会自动执行,所以我将这个工具包添加到我的libs文件夹中,然后将它添加到dependencies.gradle。

现在我想直接从我的JDK主页中将它带入我的dependencies.gradle。有没有办法做到这一点?我已经在我的dependencies.gradle中尝试了下一个:

 编译文件($ {System.properties ['java.home' ]} / lib / tools.jar)

但编译时找不到它。

解决方案

找到它了。 系统属性'java.home'不是JAVA_HOME环境变量。 JAVA_HOME指向JDK,而java.home指向JRE。有关详情,请参见该页面



我的问题是,我的起点是jre文件夹(C:\ jdk1.6.0_26\\jj)而不是jdk文件夹(C:\ jdk1.6.0_26),因为我认为tools.jar位于C:\jdk1.6.0_26\lib文件夹中)。在dependencies.gradle中的编译行应该是:

 编译文件($ {System.properties ['java.home'] } /../ lib / tools.jar)


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).

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 .

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.

解决方案

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... My problem was that my startpoint was the jre folder (C:\jdk1.6.0_26\jre) and not the jdk folder (C:\jdk1.6.0_26) as I thought(tools.jar is on the C:\jdk1.6.0_26\lib folder ). The compile line in dependencies.gradle should be:

compile files("${System.properties['java.home']}/../lib/tools.jar")

这篇关于Gradle没有找到tools.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆