I installed jenkins on Cnetos 7 using the following:
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --impor
I was trying to install it in kubuntu 18.04, and i was already sure that i had java installed, I confirmed by trying
java -version
I got the output like that
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
Since I already know that my java PATH variables are defined in /etc/environment file, I added that file to the top of /etc/init.d/jenkins file
source /etc/environment
you can even remove the PATH from /etc/init.d/jenkins file, since it's already defined in /etc/environment
after that, i restarted my jenkins server,and it seemed to start working fine from localhost:8080