This video shows the steps to fix the Java Error: “Could not find tools.jar. Please check that C:\Program Files\Java\jre-1.8 contains a valid JDK installation.”
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Complete details/ steps:
Error Window:
PS C:\Work\GooglePaLMAPI\google-cloud-ai-generativelanguage-v1beta3-java> ./gradlew publishToMavenLocal
> Task :proto-google-cloud-ai-generativelanguage-v1beta3-java:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':proto-google-cloud-ai-generativelanguage-v1beta3-java:compileJava'.
> Could not find tools.jar. Please check that C:\Program Files\Java\jre-1.8 contains a valid JDK installation.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
1 actionable task: 1 executed
PS C:\Work\GooglePaLMAPI\google-cloud-ai-generativelanguage-v1beta3-java> set JAVA_HOME=C:\Program Files\Java\jdk-13.0.2
PS C:\Work\GooglePaLMAPI\google-cloud-ai-generativelanguage-v1beta3-java> echo %JAVA_HOME%
%JAVA_HOME%
PS C:\Work\GooglePaLMAPI\google-cloud-ai-generativelanguage-v1beta3-java>
Solution:
C:\Work\GooglePaLMAPI\google-cloud-ai-generativelanguage-v1beta3-java>set JAVA_HOME=C:\Program Files\Java\jdk-13.0.2
C:\Work\GooglePaLMAPI\google-cloud-ai-generativelanguage-v1beta3-java>echo %JAVA_HOME%
C:\Program Files\Java\jdk-13.0.2
C:\Work\GooglePaLMAPI\google-cloud-ai-generativelanguage-v1beta3-java>./gradlew publishToMavenLocal
'.' is not recognized as an internal or external command,
operable program or batch file.
C:\Work\GooglePaLMAPI\google-cloud-ai-generativelanguage-v1beta3-java>gradlew publishToMavenLocal
BUILD SUCCESSFUL in 9s
17 actionable tasks: 10 executed, 7 up-to-date
C:\Work\GooglePaLMAPI\google-cloud-ai-generativelanguage-v1beta3-java>