Jenkins failure Java 12 OpenJDK - The JAVA_HOME environment variable is not defined correctly

試著忘記壹切 提交于 2021-01-28 11:41:49

问题


Configuring Jenkins (2.121.3) to use JDK 12 in the Global Tool Configuration->JDK installations... menu using "Download URL for binary archive" produces the following error when performing a build:

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

How can I resolve this issue?


回答1:


The tar file has a directory called jdk-12 inside it, so when Jenkins extracts it, the named jdk folder is not the direct parent of the bin directory.

/var/jenkins_home/tools/hudson.model.JDK/Java12/jdk-12/bin

should be

/var/jenkins_home/tools/hudson.model.JDK/Java12/bin

To fix this, extract the tar file, go into the jdk-12 folder, tar czf openjdk-12_linux-x64_bin.tar.gz *, upload it somewhere accessible to Jenkins and put the URL in the "Download URL for binary archive" field in the Global Tool Configuration->JDK installations... installer.



来源:https://stackoverflow.com/questions/55540287/jenkins-failure-java-12-openjdk-the-java-home-environment-variable-is-not-defi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!