Skip to content
Advertisement

Gradle does not find 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.

Advertisement

Answer

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_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")
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement