Since 2017, Jenkins dropped support for Java 7 and nowadays, using Java 8.
I'm trying to install Jenkins on a Debian Jessie (docker container), and I'm using the following procedure obtained via this link:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
In the last step of the procedure, this happened:
$ apt-get install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
jenkins : Depends: default-jre-headless (>= 2:1.8) but 2:1.7-52 is to be installed or
java8-runtime-headless but it is not installable
E: Unable to correct problems, you have held broken packages.
I found a solution here:
$ apt install -t jessie-backports openjdk-8-jre-headless ca-certificates-java
Anyway, I managed to install Jenkins, but when start Jenkins, this happens:
$ sudo /etc/init.d/jenkins start
[FAIL] Starting Jenkins Automation Server: jenkins failed!
$ tail -f /var/log/jenkins/jenkins.log
Jenkins requires Java8 or later, but you are running 1.7.0_151-b01
from /usr/lib/jvm/java-7-openjdk-amd64/jre
java.lang.UnsupportedClassVersionError: 51.0
at Main.main(Main.java:124)
Do I have to install Java 8 to Debian Jessie, for example?