Jenkins not detecting java on ubuntu, how to fix that?

Downloaded adopt openjdk version 8 and extracted on the machine.
Set the path variable and JAVA_HOME in /etc/environment and /etc/bash.rc also.

JAVA_HOME="/home/adminuser/Desktop/jdk8u282-b08"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/adminuser/Desktop/jdk8u282-b08/bin"

#both are working

java -version

type -p java

But when I started jenkins service, it is not detecting the java.
Can you please suggest.
Installing from apt is not an feasible option as we need this specific java version for project.

Answer

Attribution
Source : Link , Question Author : uday , Answer Author : Community

Leave a Comment