Issue
I'd like to upgrade java from 8 to 11 as recommended for Jenkins 2.303.1, I'm reading the guide in https://www.jenkins.io/doc/administration/requirements/upgrade-java-guidelines/, but I don't know what to do in step:
Use a package manager to install the new JVM. Make sure the default JVM is the newly installed version. If it is not, use the correct java command in the Jenkins startup scripts (/etc/default/jenkins or /etc/init.d/jenkins).
does it mean install Java 11 and set java 11 is default one?
Solution
However you have (OpenJDK) 11 installed, as long as you have either JAVA_HOME=/path/to/jdk11
and PATH=$JAVA_HOME/bin:$PATH
or explicitly run /path/to/jdk11/bin/java -jar jenkins.war
or if you type java -version
and it returns "11", you are fine.
Note: that is to launch jenkins. You can set the JDK available to your jenkins jobs from within Manage | Global Tools Configurationtion.
2nd Note (updated): the documentation has been updated (2021-09-16) ... The default Docker image jdk as of 2.303.1 is now 11, so you don't need to append ”-jdk11", rather users must append "-jdk8" if users want to stick to 8.
Answered By - Ian W
Answer Checked By - Marie Seifert (JavaFixing Admin)