. Advertisement .
..3..
. Advertisement .
..4..
If you are an IT professional working with Java and Java-related applications, you have surely come across the “ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation” error at one time or other. This blog will provide some tips and suggestions to help you address this error so that you can get your work done without the need to worry about encountering this error when you least expect it.
Where dose the “ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation” error comes from?
When you’ve set up JDK, you may still get the following error.
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/export/export_lib.py”, line 25, in from tensorflow.python.saved_model.model_utils import build_all_signature_defs ModuleNotFoundError: No module named ‘tensorflow.python.saved_model.model_utils’
The problem can be from setting up JDK and you need to check the tool versions such as jdk – v11; node – v16.13.1; and Gradle – v6.1.1. So, it sometimes both JDK and jre are not on the same version for example if you have JRE version 1.8.0_201 then JDK version is not be 1.8.0_201 version. To fix it, refer to the below part.
How To Handle This Error ?
Option 1: In gradle.properties, include java home.
Simply add the java home JDK path to the gradle.properties file. It’s similar to this.
org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_144
Then, attempt to recreate the project. Now, you have fixed your error.
Option 2: Copy tools.jar
All you have to do now is adding tools. This path is C:Program FilesJavajre1.8lib jar file.
- Firstly, copy tools.
- Copy the jar file from C:\Program Files\Java\jdk1.8.0_121\lib to C:\Program Files\Java\jre1.8\lib and paste it here.
- Now you must correct your mistake.
Option 3: JAVA HOME can be added to environment variables.
Make sure JAVA HOME is set in the environment variables. Or else, simply follow the steps below.
-
First, download and install the JDK with the similar version number as the JRE from the Oracle website.
-
Then, in Windows’ environment variables, add JAVA HOME.
-
That’s how it should be. Javajdk1.8.0 121 C:Program FilesJavajdk1.8.0 121
-
Refresh the terminal or development environment to apply the new JAVA HOME setting.
- Now, you have resolved your problem.
Option 4: Follow these steps
- Install the JDK from the Oracle website with the same version number as the JRE if you didn’t.
- From the Windows, add JAVA_HOME to the environment variables.
- Start again with the terminal or development environment to load the new JAVA_HOME value.
Option 5: Add jdk path
to gradle.properties file and did a rebuild.
Option 6: In Eclipse
Do the following way to fix it correctly
- Right click Project -> Java Build Path –> Librarie
- Delete the JRE
- Select Add Library -> JRE System Library ->Next ->Alternate JRE -> installed JRE -> Add JDK and choose and run
Conclusion
We hope you enjoyed our article about this confusing error. With this knowledge, we know that you can fix your “ERROR: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation” problem in Windows quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Leave a comment