0
votes

My default java is located in the following location-

admin@pc1:~$ readlink -f $(which java)
/usr/lib/jvm/java-11-openjdk-amd64/bin/java

So,I set the above directory (ie./usr/lib/jvm/java-11-openjdk-amd64/bin/java) as the JAVA_HOME in the Jenkins-Global Tool Configuration but, it's showing the following message-

/usr/lib/jvm/java-11-openjdk-amd64/bin/java is not a directory on the Jenkins master (but perhaps it exists on some agents)

So I removed the /bin/java -portion and pasted the following /usr/lib/jvm/java-11-openjdk-amd64but, it still showing the same message.

$JAVA_HOME was not previously set to my pc,So I set the $JAVA_HOME to /usr/lib/jvm/java-11-openjdk-amd64 through terminal;then I again tried to set the JAVA_HOME in Jenkins, but, it's still showing the same message.

What is the reason?

1

1 Answers

0
votes

Are you using any separate user than admin to start Jenkins? In that case, you need to check if java_home is set for that user also? For my case, I am using root user to start jenkins an java home is set for root user and it works fine.One more place to check that is Jenkins configuration file . Possible location is /etc/default or /etc/sysconfig/jenkins for most of the Linux OS. Here, you can specify env variable to set JAVA_HOME. Please refer this url for reference :https://support.cloudbees.com/hc/en-us/articles/209715698-How-to-add-Java-arguments-to-Jenkins- JAVA_HOME should be set like /usr/lib/jvm/java-6-openjdk ....