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.
Best Answer
I had this problem when I was trying to run commands through CLI.
It was a problem with system looking at the JRE folder i.e.
D:\Program Files\Java\jre8\bin
. If we look in there, there is noTools.jar
, hence the error.You need to find where the
JDK
is, in my case:D:\Program Files\Java\jdk1.8.0_11
, and if you look in thelib
directory, you will seeTools.jar
.What I did I created a new environment variable
JAVA_HOME
:And then you need to edit your PATH variable to include JAVA_HOME, i.e.
%JAVA_HOME%/bin;
Re-open command prompt and should run.