6

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

user5620472
  • 2,722
  • 8
  • 44
  • 97
  • Check this and see if it helps https://stackoverflow.com/a/11345708/6266949 – Jason Krs Aug 02 '17 at 09:03
  • check your env variables JDK != JRE - see your other [question](https://stackoverflow.com/questions/45457282/gradle-not-found-java-class-path/45459678#45459678) – chux Aug 02 '17 at 11:35

1 Answers1

8

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.

Mindsect Team
  • 2,311
  • 5
  • 29
  • 36