Changing the JRE used by CloudBees products on Windows

Article ID:360044830532
1 minute readKnowledge base


Due to changes in the Oracle license agreement CloudBees products are changing to include OpenJDK java executables. With this change, some customers will want to continue using Oracle releases.


The Java executable to use for a CloudBees product is defined in the jenkins.xml file in the $JENKINS_HOME directory. In order to change which JRE is used, this file must be editted. The following steps will make this change:

  1. Backup the jenkins.xml before making any changes.

  2. Open the file to edit.

  3. Locate the service tag in the file and under that, the executable tag.

  4. Edit the contents of the executable tag and replace %BASE%\jre\bin\java with the full path of the java executable of the JRE or JDK to be used.

  5. Save this modified file.

  6. Restart the instance to enact the change.

See the example of a system on CloudBees Core on traditional Platforms Client controller The line to change can be found on line 10 of this example file.

  <description>This service runs Jenkins automation server.</description>
  <env name="JENKINS_HOME" value="%BASE%"/>
    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.
  <arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar -Dcb.distributable.commit_sha=d0fff650a006d3d5d717de88b6220fb05f7ce01e "%BASE%\cloudbees-core-oc.war" --httpPort=8888 --webroot="%BASE%\war"</arguments>
    interactive flag causes the empty black Java window to be displayed.
    I'm still debugging this.
  <interactive />

  <onfailure action="restart" />

    In the case WinSW gets terminated and leaks the process, we want to abort
    these runaway JAR processes on startup to prevent corruption of JENKINS_HOME.
    So this extension is enabled by default.
    <!-- This is a sample configuration for the RunawayProcessKiller extension. -->
    <extension enabled="true"

  <!-- See the referenced examples for more options -->


You can confirm that the new Java executable is being used by navigating to Manage Jenkins -> System Information. The java.home and the java.vendor fields there should show the new Java JRE or JDK.

Tested product/plugin versions

  • Managed controllers - and

  • Client controllers - and

  • Oracle JDK 8

  • OpenJDK 8