Home > Back-end >  How do I change the Java version used by Jenkins?
How do I change the Java version used by Jenkins?

Time:08-31

I am trying to change the version of Java used by Jenkins from Java 8 to Java 11. Jenkins is running on Windows Server 2016. I've installed the Java 11 SDK. I have tried creating a system environment variable JAVA_HOME pointing to my Java 11 installation (per instructions https://www.jenkins.io/doc/administration/requirements/upgrade-java-guidelines). I have also tried updating the Jenkins.xml file to point to the Java 11 installation. I was unable to access the Jenkins server after trying either of these methods (although it looked like the Jenkins service was running). How can I point my Jenkins service to my new Java 11 installation?

Jenkins was installed about a year ago using instructions in the Docs (https://www.jenkins.io/doc/book/installing/windows). It is installed as a service.

Current version: 2.346.3 Version of JDK installed: 11.0.16.1

The Java 8 version was installed (jre) with the original Jenkins install. The Java 11 version (JDK) was installed separately.

Here is my original Jenkins.xml file:

<service>
  <id>Jenkins</id>
  <name>Jenkins</name>
  <description>This service runs Jenkins automation server.</description>
  <env name="JENKINS_HOME" value="C:\Jenkins\Workspace"/>

 <!--if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
The following value assumes that you have java in your PATH.-->

  <executable>           
  • Related