Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 416
user5620472 Avatar asked Aug 02 '17 09:08

user5620472


People also ask

Where can I find the jar in gradle project?

The Jar is created under the $project/build/libs/ folder.

Can not determine path to Tools jar?

The problem is with version of JDK you are using. The Intellij version 2020.2 supports only upto JDK 14. So either you have to lower the JDK version to 14 or update the IntelliJ to a newer version like 2021.

Can't find tools jar contains a valid JDK installation Linux?

First of all Download And Install the JDK from the Oracle website with the same version number as the JRE if you didn't already. Then add JAVA_HOME to the environment variables of Windows. Restart your terminal or development environment to load the new JAVA_HOME value. Now, Your error must be solved.


1 Answers

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.

like image 151
Mindsect Team Avatar answered Sep 28 '22 14:09

Mindsect Team