B Updating the JDK After Installing and Configuring an Oracle Fusion Middleware Product

If the JDK configured with an Oracle home or domain home is no longer certified or is no longer the JDK that you want to use, update the JDK location so Oracle Fusion Middleware utilities, such as Configuration Wizard (config.sh|cmd), OPatch, and domain startup scripts, use the certified JDK.

Oracle WebLogic Server 26 (26.1.0.0.0) supports JDK version 21, and JDK 25. See Oracle Fusion Middleware Supported System Configurations for the JDK versions certified with this release.

You can maintain multiple certified JDK versions and switch to the required version as needed.

About Updating the JDK Location After Installing an Oracle Fusion Middleware Product

Update the JDK location used by Oracle Fusion Middleware utility scripts and domain files when you change to another certified JDK.

The utility scripts, such as config.sh|cmd, launch.sh, or opatch, reside in the ORACLE_HOME, and when you invoke them, they refer to the JAVA_HOME variable located in the .globalEnv.properties file. To point these scripts and utilities to the newer version of JDK, you must update the value of the JAVA_HOME variable in the .globalEnv.properties file by following the directions listed in Updating the JDK Location in an Existing Oracle Home.

To make the scripts and files in your Domain home directory point to the newer version of the JDK, you can follow one of the following approaches:
  • Specify the path to the newer JDK on the Domain Mode and JDK screen while running the Configuration Wizard.

    For example, if you configured the Oracle home using JDK 21 and later install JDK 25, select the JDK 25 home on the Domain Mode and JDK screen of the Configuration Wizard. Example: /scratch/jdk/jdk-25.

  • Manually locate the files that have references to the JDK using grep (Linux) or findstr (WINDOWS) commands and update each reference.

    See Updating the JDK Location in an Existing Oracle Home.

Note:

If you install the newer version of the JDK in the same location as the existing JDK by overwriting the files, then you don’t need to take any action.

Updating the JDK Location in an Existing Oracle Home

The getProperty.sh|cmd script displays the value of a variable, such as JAVA_HOME, from the .globalEnv.properties file. The setProperty.sh|cmd script is used to set the value of variables, such as OLD_JAVA_HOME or JAVA_HOME that contain the locations of old and new JDKs in the .globalEnv.properties file.

The getProperty.sh|cmd and setProperty.sh|cmd scripts are in the following location:

(Linux) ORACLE_HOME/oui/bin

(Windows) ORACLE_HOME\oui\bin

Where, ORACLE_HOME is the directory that contains the products using the current version of the JDK, such as /path/to/jdk-21.

To update the JDK location in the .globalEnv.properties file:
  1. Use the getProperty.sh|cmd script to display the path of the current JDK from the JAVA_HOME variable. For example:

    (Linux) ORACLE_HOME/oui/bin/getProperty.sh JAVA_HOME

    (Windows) ORACLE_HOME\oui\bin\getProperty.cmd JAVA_HOME

    echo JAVA_HOME

    Where JAVA_HOME is the variable in the .globalEnv.properties file that contains the location of the JDK.

  2. Back up the path of the current JDK to another variable such as OLD_JAVA_HOME in the .globalEnv.properties file by entering the following commands:

    (Linux) ORACLE_HOME/oui/bin/setProperty.sh -name OLD_JAVA_HOME -value specify_the_path_of_current_JDK

    (Windows) ORACLE_HOME\oui\bin\setProperty.cmd -name OLD_JAVA_HOME -value specify_the_path_of_current_JDK

    This command creates a new variable called OLD_JAVA_HOME in the .globalEnv.properties file, with a value that you have specified.
  3. Set the new location of the JDK in the JAVA_HOME variable of the .globalEnv.properties file, by entering the following commands:

    (Linux) ORACLE_HOME/oui/bin/setProperty.sh -name JAVA_HOME -value specify_the_location_of_new_JDK

    (Windows) ORACLE_HOME\oui\bin\setProperty.cmd -name JAVA_HOME -value specify_the_location_of_new_JDK

    After you run this command, the JAVA_HOME variable in the .globalEnv.properties file now contains the path to the new JDK, such as /path/to/jdk-25.

Updating the JDK Location in an Existing Domain Home

Before updating JDK references in an existing domain home, back up DOMAIN_HOME.

Search DOMAIN_HOME for the old JDK path and replace every generated reference with the new certified JDK path. At minimum, check the following files when they exist:

  • (Linux) DOMAIN_HOME/bin/setDomainEnv.sh

  • (Windows) DOMAIN_HOME\bin\setDomainEnv.cmd

  • (Linux) DOMAIN_HOME/bin/setNMJavaHome.sh

  • (Windows) DOMAIN_HOME\bin\setNMJavaHome.cmd

  • (Linux and Windows) DOMAIN_HOME/nodemanager/nodemanager.properties

  • (Linux and Windows) DOMAIN_HOME/init-info/tokenValue.properties

  • (Linux and Windows) DOMAIN_HOME/init-info/domain-info.xml

  • (Linux and Windows) DOMAIN_HOME/init-info/nodemanager-properties.xml

  • (Linux and Windows) DOMAIN_HOME/init-info/startscript.xml

After updating the files, verify that DOMAIN_HOME no longer contains the old JDK path. Restart Node Manager and any affected servers so the updated JDK path is used.