user5620472
user5620472

Reputation: 2882

Could not find tools.jar when build gradle project

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

Upvotes: 6

Views: 15037

Answers (1)

Mindsect Team
Mindsect Team

Reputation: 2571

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.

Upvotes: 8

Related Questions