For the complete documentation index, see llms.txt. This page is also available as Markdown.

Java 21.x Upgrade (Windows)

Upgrading the Java Development Kit (JDK) is critical for maintaining security, performance, and compatibility with modern Java applications. This document provides step-by-step instructions for upgrading Java to JDK 21.x on a Windows machine, reconfiguring environment variables, and reintegrating the JDK with an existing Apache Tomcat service.

Prerequisites

Before starting the upgrade, ensure the following:

  • Administrator access to the Windows machine.

  • Backup of the current Tomcat configuration, including Java Options and Heap Size.

  • Tomcat service is stopped before the upgrade.

  • Internet access available to download the JDK installer.

Upgrade Process Steps

  1. Stop and Backup Tomcat Configuration

    • Open Services → Locate the Tomcat service → Right-click → Stop.

    • Navigate to the Tomcat bin directory.

    • Open Command Prompt in that directory and run:

      tomcat10w.exe //ES//<TomcatServiceName>

      Sample Reference Screenshot:

      (Replace <TomcatServiceName> with your actual Tomcat service name).

    • In the Java tab, note down:

      • Java Options

      • Heap Size values (Copy to a Notepad for later reference).

    • Uninstall the existing Tomcat service:

      service.bat remove <TomcatServiceName>

      Sample Reference Screenshot:

  1. Uninstall Previous JDK Version

    • Open Control Panel → Programs → Programs and Features.

    • Locate the existing Java/JDK installation.

    • Right-click → Uninstall.

  2. Download and Install JDK 21.x

  3. Set Environment Variables

    • Press Windows Key → Search for Environment Variables → Open Edit the system environment variables.

    • Click Environment Variables.

      • Under System Variables → New:

        • Variable Name: JAVA_HOME

        • Variable Value:

      • Under System Variables → Path → Edit: Ensure the following entry exists (if not already present):

  4. Verify Java Installation

    • Open Command Prompt and run:

    • Expected output:

      Sample Reference Screenshot:

  5. Reconfigure Tomcat Service

    • Navigate to Tomcat’s bin directory:

    • Reinstall the Tomcat service:

    • Open Tomcat configuration:

      Sample Reference Screenshot:

    • Under the Java tab:

      • Restore previously saved Java Options and Heap Size.

      • Update paths if necessary (e.g., to extprop or log4j.properties).

    • Under the General tab:

      • Set Startup Type → Automatic (Delayed Start).

    • Return to Services → Locate Tomcat service → Start.

Validation

After Tomcat is started:

  • Review catalina.out or stdout/stderr logs for errors.

  • Confirm application accessibility through the web interface.

  • Verify environment variables:

  • Ensure it points to the new JDK directory.


Copyright © 2025, OvalEdge LLC, Peachtree Corners, GA, USA.

Was this helpful?