close

[Solved] ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation

Hello Guys, How are you all? Hope You all Are Fine. Today I am configured JDK But Still I am facing following error ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How this Error Occurs ?

I am configured JDK But Still I am facing following error.

Execution failed for task ‘:sample:compileReleaseJavaWithJavac’.
ERROR:
Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation.`

How To Solve ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation Error ?

  1. How To Solve ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation Error ?

    To Solve ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation Error You Just need to add java home JDK path in gradle.properties Just like this: org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_144 Then try to rebuild project. Now your error must be solved. Second solution is You just need to add tools.jar file to C:\Program Files\Java\jre1.8\lib this Path. First of all Copy tools.jar file from C:\Program Files\Java\jdk1.8.0_121\lib and then Paste in C:\Program Files\Java\jre1.8\lib Here. Now your error must be solved.

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

    To Solve ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation Error You Just need to add java home JDK path in gradle.properties Just like this: org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_144 Then try to rebuild project. Now your error must be solved. Second solution is You just need to add tools.jar file to C:\Program Files\Java\jre1.8\lib this Path. First of all Copy tools.jar file from C:\Program Files\Java\jdk1.8.0_121\lib and then Paste in C:\Program Files\Java\jre1.8\lib Here. Now your error must be solved.

Solution 1: Add java home in gradle.properties

You Just need to add java home JDK path in gradle.properties Just like this.

org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_144

Then try to rebuild project. Now your error must be solved.

Solution 2: Copy tools.jar

You just need to add tools.jar file to C:\Program Files\Java\jre1.8\lib this Path.

  1. First of all Copy tools.jar file from C:\Program Files\Java\jdk1.8.0_121\lib
  2. and then Paste in C:\Program Files\Java\jre1.8\lib Here.
  3. Now your error must be solved.

Solution 3: add JAVA_HOME to environment variables 

Make sure you have added JAVA_HOME to environment variables. If not then just follow this procedure.

  1. 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.
  2. Then add JAVA_HOME to the environment variables of Windows.
  3. It should be like this. C:\Program Files\Java\jdk1.8.0_121
  4. Restart your terminal or development environment to load the new JAVA_HOME value.
  5. Now, Your error must be solved.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment