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 FilesJavajre8bin. If we look in there, there is no Tools.jar, hence the error.
You need to find where the JDK is, in my case: D:Program FilesJavajdk1.8.0_11, and if you look in the lib directory, you will see Tools.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.
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”)