6
votes

I try build gradle project and get error:

Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_144 contains a valid JDK installation.

I add to path

C:\Program Files\Java\jdk1.8.0_112\bin
C:\Program Files\Java\jre1.8.0_144\bin

when I write java and javac in console all works. But project not build

1
Check this and see if it helps stackoverflow.com/a/11345708/6266949Jason Krs
check your env variables JDK != JRE - see your other questionchux

1 Answers

7
votes

The reason it works in your console is because your console is most likely picking up its JDK from your JAVA_HOME value in your environment settings.

For Gradle, you need to create a gradle.properties file in your application's root directory (if it does not already exist) and add the following line:

org.gradle.java.home=C:/path/to/your/jdk

When you copy your path from the Windows Explorer, please remember to change "\" to "/", otherwise, they will be escaped and you will receive an error inside of Eclipse.