Solution for “Not able to find Java executable or version” in Jenkins
This is the solution for the error I met in Jenkins when practicing the InClass exercise today. Hope it helps anyone who is also facing it.
After setting up everything as instruction for Jenkins -> Build Now -> I got an error (red progress bar) and when looking at Console output:
Not able to find Java executable or version. Please check your Java installation.
errorlevel=2
Note: My Java_Home, JRE_Home is still configured correctly in the environment variables.
Solution:
1. From Jenkins dashboard -> Manage Jenkins -> Global Tool Configuration
2. JDK installations -> Add JDK manually: JDK-1.8, JAVA_HOME= path to JDK folder (ex: C:\Program Files\Java\jdk1.8.0_202)
- Some people said we should also add:
- JAVA_HOME in Manage Jenkins -> Configure System -> Global properties: Add Environment variables.
- But I don’t do this step, it still works. If after step 2 above your Jenkins hasn’t worked yet, try this step.