Jenkins & Java Upgrade on Windows

One service that I use quite frequently in my lab is Jenkins. I have this running on a Windows VM and have a variety of tasks that run from there, some on a scheduled and others consumed by web hooks. For example, I have a job that Aria Automation calls to create records on my Windows DNS server for Linux/nested ESXi builds.

I recently was looking in the Manage Jenkins section and noticed two issues, one that Jenkins needed an upgrade and another that stated You are running Jenkins on Java 11, support for which will end on or after Sep 30, 2024.

Updating Jenkins was super easy. I created a snapshot of the VM, in case things went sideways, and then pushed the button to update Jenkins from within the web console. This took care of itself and when Jenkins restarted it was current. I let this sit a few days, run a variety of tests, and when I was happy that everything was stable I deleted the VM snapshot.

The second task was to update Java, and I decided to do this a few days after the above Jenkins update. That way if something went wrong it would be easier to know if it were a Jenkins or Java issue. I’m glad I did, as I ran into two issues when updating Java, described below.

To start the upgrade process, I downloaded the latest version of Java 17 JDK from https://adoptium.net/temurin/releases/?os=windows&arch=x64&version=17. I also backed up my D:\Program Files\Jenkins and C:\Users\svc-jenkins\AppData\Local\Jenkins folders. I had done this prior to updating Jenkins and decided it would be wise to do again for the Java update. I then took a snapshot of the virtual machine as one last restore point.

With backups in place, I stopped the Jenkins service (from services.msc on the Windows VM), and uninstalled Java JDK 11 from add/remove programs. This is the only application using Java, so I wasn’t worried about other application dependencies. I then installed JDK 17 into D:\Program Files\Eclipse Adoptium\jdk-17.0.9.9-hotspot, selecting that I wanted to add an entry to my PATH statement, associate JAR files, and set the JAVA_HOME variable.

After the installation completed, I attempted to start the Jenkins service, but it stopped immediately. I then decided to reboot, as I had changed system environment variables and wanted to make sure those were in effect, but the service did not start on boot. Since I knew that the path to java.exe had changed, I went looking for a Jenkins configuration that pointed at the old file system path — I found such an entry in D:\Program Files\Jenkins\jenkins.xml and updated the <executable> location. After doing so the service started successfully, however I was only able to access it locally from the server console and not on a remote machine.

I checked the Windows firewall and found an inbound rule for Jenkins that was restricted to only one program — the previous path to Jenkins. I updated the ‘this program’ value on the programs and services tab to D:\Program Files\Eclipse Adoptium\jdk-17.0.9.9-hotspot\bin\java.exe, which resolved the remote access issues.

Now my Jenkins & Java versions are up-to-date and everything is working as expected. Hopefully this article helps someone else who runs into issues with this upgrade.

This entry was posted in Lab Infrastructure, Scripting. Bookmark the permalink.

One Response to Jenkins & Java Upgrade on Windows

  1. Pingback: 詹金斯和 Java 在 Windows 上升級 - Jiayun

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Notify me of followup comments via e-mail. You can also subscribe without commenting.