Upgrading Jenkins Java version from 11 to 17

There are a few details and steps to upgrade the JVM used to run Jenkins, more specifically from Java 11 to Java 17.

If you’re upgrading the JVM used to run Jenkins, particularly from Java 11 to Java 17, there are some details you should know and precautions you should take.

Upgrading Jenkins Java Version From 11 to 17

Backing up Jenkins

As with any upgrade, we recommend backing up JENKINS_HOME and testing the upgrade with the backup before performing the upgrade on your production instance.

Upgrading Jenkins

If you need to upgrade Jenkins as well as the JVM, we recommend that you:

  1. Update all of your installed plugins.

  2. Back up JENKINS_HOME.

  3. Stop the Jenkins instance.

  4. Upgrade the JVM on which Jenkins is running.

    • Use a package manager to install the new JVM.

    • Make sure the default JVM is the newly installed version. If it is not, run systemctl edit jenkins and set either the JAVA_HOME environment variable or the JENKINS_JAVA_CMD environment variable.

  5. Upgrade Jenkins to the most recent version

    • How you upgrade Jenkins is dependent upon your original Jenkins installation method.

    • We recommend using the package manager of your system, such as apt or yum.

  6. Validate the upgrade to confirm that all plugins and jobs are loaded.

  7. Upgrade the required plugins. Refer to Upgrading Plugins for more information.

Upgrading Plugins

It’s important not just to upgrade Jenkins and the JVM, but also to upgrade the plugins which support Java 17. Plugin upgrades assure compatibility with the most recent Jenkins releases.

If you discover a previously unreported issue, please let us know. Refer to our issue reporting documentation for guidance.

JVM version on agents

All agents must be running on the same JVM version as the controller, due to how controllers and agents communicate. If you’re upgrading your Jenkins controller to run on Java 17, you also need to upgrade the JVM on your agents.

Validating the version of each agent can be done with the Versions Node Monitors plugin. This plugin provides information about the JVM version of each agent on the node management screen of your Jenkins instance. This plugin can also be configured to automatically disconnect any agent with an incorrect JVM version.