Java Runtime Lifecycle Management

Java runtime lifecycle management includes:

  • Install and Configure a Java runtime
  • Delete a Java runtime
  • Manage Deployment Rule Set

Install and Configure a Java Runtime

JMS allows you to install any Oracle JDK on any selected or all managed instances within your fleet. Additionally, you can further configure your new Java runtimes with post installation actions.

For each supported platform you can choose if you would like to install Java runtime as ordinary archive, which will be extracted to a selected location on the file system, or JMS will install Oracle JDK by executing the official Oracle JDK installer for the selected platform.

OCI Cloud Console

  1. Sign in to the OCI Console as an administrator.
  2. Open the navigation menu, click Observability & Management, and then click Fleets under Java Management.
  3. Select your fleet.
  4. Click Actions and from menu select Install Java runtime.
  5. Select version you want to install.
  6. Click Next.
  7. You have an option to install Java through platform specific JDK installer or download Java archive and extract it to a specified path, continue by clicking Next.
  8. Click Install Java Runtime.

OCI CLI

  1. Generate payload for installation with the following command:
    oci jms installation-site-summary add --generate-param-json-input installation-sites
  2. Edit the payload json file, for example:
    [
      {
        "artifactContentType": "JDK",
        "managedInstanceId": "$MANAGED_INSTANCE_OCID",
        "releaseVersion": "21"
      }
    ]
  3. Execute the following command:
    oci jms installation-site-summary add --fleet-id $FLEET_OCID --installation-sites file://installation-sites.json

Configure the new Java Runtime

Each installation of Java Runtime can be configured with several options for enhanced security, network configuration or logging. For detailed description of all configuration options, see Java Post-Installation Actions. For example, you can use this feature for global proxy configuration of the Java runtime in your environment.

You can can run the action from either the OCI Cloud Console, or from the OCI CLI.

OCI Cloud Console

  1. Sign in to the OCI Console as an administrator.
  2. Open the navigation menu, click Observability & Management, and then click Fleets under Java Management.
  3. Select your fleet.
  4. Click Actions and from the menu select Configure Java runtime lifecycle management settings.
  5. Under the Java post-installation actions section, configure your requirements.
  6. Click Save.
  7. Now you can start the Java runtime installation process described above and in the dialog's second step confirm your newly configured post installation actions.

OCI CLI

  1. Generate LCM configuration for fleet using the following command:
    oci jms fleet-advanced-feature-configuration update --generate-param-json-input lcm
  2. Update the file with your changes, for example:
    {
        "isEnabled": true,
        "postInstallationActions": {
          "proxies": {
            "httpProxyHost": "my-awesome-company-proxy",
            "httpProxyPort": 8080,
            "httpsProxyHost": "my-awesome-company-proxy",
            "httpsProxyPort": 8080,
            "useSystemProxies": false
          }
        }
    }
  3. Upload the fleet configuration:
    oci jms fleet-advanced-feature-configuration update --lcm file://lcm-update.json --fleet-id $FLEET_OCID
  4. Update your installation payload file, for example:
    [
      {
        "artifactContentType": "JDK",
        "managedInstanceId": "$MANAGED_INSTANCE_OCID",
        "releaseVersion": "21"
      }
    ]
  5. Execute the installation script:
    oci jms installation-site-summary add \
            --fleet-id "$FLEET_OCID" \
            --installation-sites file://installation-sites.json \
            --post-installation-actions '["SETUP_HTTP_PROXY","SETUP_HTTPS_PROXY"]'

Delete a Java Runtime

JMS provides a list of discovered Java runtimes of all managed instances in the fleet. The fleet administrator has an option to remove any Oracle Java runtime either from the selected managed instance or from all managed instances within a JMS fleet.

OCI Cloud Console

  1. Sign in to the OCI Console as an administrator.
  2. Open the navigation menu, click Observability & Management, and then click Fleets under Java Management.
  3. Select your fleet.
  4. Click on the Java runtimes section and select Oracle Java runtime.
  5. Click Delete.
  6. Click Delete again to confirm.

OCI CLI

  1. Generate payload for deletion with the following command:
    oci jms installation-site-summary remove --generate-param-json-input installation-sites
  2. Get installation keys for given fleet and Java version:
    oci jms installation-usage summarize --fleet-id $FLEET_OCID --jre-version
          $ORACLE_JDK_VERSION
  3. Get managed instances OCIDs for given fleet with installed Java version:
    oci jms managed-instance-usage summarize --fleet-id $FLEET_OCID --jre-version
          $ORACLE_JDK_VERSION

    Note:

    You can find managed instances only for specific platform with additional parameter --os-family.
  4. Combine the installation keys with managed instances, installation key and managed instance are platform specific, for example:
    [
      {
        "installationKey": "$JAVA_RUNTIME_INSTALL_KEY_LINUX",
        "managedInstanceId": "$LINUX_MANAGED_INSTANCE_OCID"
      },
      {
        "installationKey": "$JAVA_RUNTIME_INSTALL_KEY_WINDOWS",
        "managedInstanceId": "$WINDOWS_MANAGED_INSTANCE_OCID"
      }
    ]
  5. Once you have completed the list of installation key and managed instance pairs, save the installation-sites configuration to a file named installation-sites.json.
  6. Execute the following command:
    oci jms installation-site-summary remove --fleet-id $FLEET_OCID --installation-sites
          file://installation-sites.json

Manage the Deployment Rule Set

A Deployment Rule Set is a set of rules and policies used to control and manage the execution of Java applets and web applications in a secure and customizable manner.

With JMS the managing of a Deployment Rule Set jar is simple task. The fleet administrator will configure it by uploading a signed jar containing deployment rules and then JMS will distribute the DRS file to all managed instances in the fleet where applicable.

Note:

The Managing of Deployment Rule Set feature is limited to Java 8 runtimes.

OCI Cloud Console

  1. Sign in to the OCI Console as an administrator.
  2. Open the navigation menu, click Observability & Management, and then click Fleets under Java Management.
  3. Select your fleet.
  4. Click Actions and select Configure Java runtime lifecycle management settings.
  5. In the Deployment Rule Set file section, upload your deployment rule set jar file.
  6. Click Upload.

Manage the Deployment Rule Set

  1. Sign in to the OCI Console as an administrator.
  2. Open the navigation menu, click Observability & Management, and then click Fleets under Java Management.
  3. Select your fleet.
  4. Click Actions and select Manage Deployment Rule Set.
  5. Click Distribute or Remove DRS panel.
  6. Click Submit.

OCI CLI

  1. Upload the DRS file with the following command:
    oci os object put --namespace $NAMESPACE --bucket-name $BUCKET_NAME --file
          DeploymentRuleSet.jar
  2. Validate it with JMS:
    oci jms fleet create-drs-file --namespace $NAMESPACE --bucket-name $BUCKET_NAME
          --drs-file-name DeploymentRuleSet.jar --fleet-id $FLEET_OCID
  3. Distribute the DRS file:
    oci jms fleet enable-drs --fleet-id $FLEET_OCID

DRS advanced feature functionality depends on sending the DRS-related payload from managed instances to the OCI Inventory log object. Here's the sample DRS payload:

{
  "datetime": 1749559306604,
  "logContent": {
    "id": "117dffe5-defd-4d62-8d4c-b4b3b5ace029",
    "time": "2025-06-10T12:41:46.604Z",
    "oracle": {
      "compartmentid": "ocid1.compartment.oc1..compartment-id",
      "ingestedtime": "2025-06-10T12:41:46.604Z",
      "loggroupid": "ocid1.loggroup.oc1.eu-frankfurt-1.log-group-id",
      "logid": "ocid1.loggroup.oc1.eu-frankfurt-1.log-id",
      "tenantid": "ocid1.tenancy.oc1..tenant-id"
    },
    "source": "ocid1.instance.oc1.eu-frankfurt-1.instance-id",
    "specversion": "1.0",
    "subject": "Oracle JMS Plugin",
    "type": "jms.drs.scan.log",
    "data": {
      "data": {
        "checksum": "405ca339f3e394a5cee7f618074f752a7c341bae2d9841155a23858d96d7696a",
        "fleetId": "ocid1.jmsfleet.oc1.eu-frankfurt-1.fleet-id",
        "managedInstanceId": "ocid1.instance.oc1.eu-frankfurt-1.instance-id",
        "osArch": "amd64",
        "osName": "Linux",
        "osVersion": "5.15.0-306.177.4.el9uek.x86_64"
      },
      "datacontenttype": "application/json",
      "dataschema": "1.0",
      "id": "117dffe5-defd-4d62-8d4c-b4b3b5ace029",
      "source": "ocid1.instance.oc1.eu-frankfurt-1.instance-id",
      "specversion": "1.0",
      "time": "2025-06-10T12:41:46.601Z",
      "type": "jms.drs.scan.log"
    }
  },
  "regionId": "eu-frankfurt-1"
}

Example

Suppose you'd like to automate Oracle JDK 21 installation with certain http/https proxy configuration. The following is a real-world example using JMS to achieve this automation.

First let's examine a simple script and define required parameters in the configuration variables section.

#!/usr/bin/env bash
 
# configuration variables
JAVA_VERSION=21
FLEET_OCID=ocid1.jmsfleet.oc1.eu-frankfurt-1.amaaaaaaptiaquqa2qxxkco6hrguz7nyug2hcpgikhe5gz4d7uy6j6ilbtta
MANAGED_INSTANCE_OCID=ocid1.instance.oc1.eu-frankfurt-1.antheljtptiaquqcrjmnu7mxbjthm2jm5qzryu7xy4w27rfo56nxf4uwv6pq
PROXY_HOST=my-awesome-company-proxy
PROXY_PORT=8080
 
# check LCM configuration
FLEET_LCM_CONFIGURED=$(oci jms fleet-advanced-feature-configuration get --fleet-id $FLEET_OCID |  jq '.data.lcm."is-enabled"')
 
# enable LCM configuration if needed
if [ "$FLEET_LCM_CONFIGURED" == "false" ]; then
cat > lcm-proxy.json << EOF
{
  "isEnabled": true,
  "postInstallationActions": {
    "proxies": {
      "httpProxyHost": "$PROXY_HOST",
      "httpProxyPort": $PROXY_PORT,
      "httpsProxyHost": "$PROXY_HOST",
      "httpsProxyPort": $PROXY_PORT,
      "useSystemProxies": false
    }
  }
}
EOF
     
    echo Uploading new LCM configuration for fleet $FLEET_OCID
    cat lcm-proxy.json
 
    # upload the LCM configuration to JMS without confirmation
    oci jms fleet-advanced-feature-configuration update --force --lcm file://lcm-proxy.json --fleet-id $FLEET_OCID
 
    rm lcm-proxy.json
fi
 
# JDK installation payload
cat > jdk-install-payload.json << EOF
[
  {
    "artifactContentType": "JDK",
    "releaseVersion": "$JAVA_VERSION",
    "managedInstanceId": "$MANAGED_INSTANCE_OCID",
  }
]
EOF
 
# initiate installation on specified managed instance
WORK_REQUEST_OCID=$(oci jms installation-site-summary add \
        --fleet-id "$FLEET_OCID" \
        --installation-sites file://jdk-install-payload.json \
        --post-installation-actions '["SETUP_HTTP_PROXY","SETUP_HTTPS_PROXY"]' | jq -r '."opc-work-request-id"')
echo Installation work request OCID: $WORK_REQUEST_OCID
rm jdk-install-payload.json
 
# additionally you can add your own logic to check if work request is finished
# sleep 600
# oci jms work-request get --work-request-id "$WORK_REQUEST_OCID" | jq .data.status

In the next step, we execute the script above and wait until is finished. Once the installation work request is finished, we can verify that the proxy configuration for newly installed JDK 21 was set with the desired configuration:

oci jms work-request-log-entry list-work-request-logs --work-request-id "$WORK_REQUEST_OCID" | jq -r '.data.items[].message'
{"artifactType":"JDK","code":"COMMAND_COMPLETED_WITHOUT_ERRORS","jrePath":"/usr/lib/jvm/jdk-21-oracle-x64/","jreVersion":"21","managedInstance":"jms-demo","metadata":{"attempt":1,"maximumAttempts":3},"operation":"LCM_OPERATION","osType":"Linux","requestType":"ARTIFACTINSTALL"}
{"artifactType":"JDK","code":"POST_INSTALL_ACTIONS_SUCCESS","jrePath":"/usr/lib/jvm/jdk-21-oracle-x64/","jreVersion":"21","managedInstance":"jms-demo","metadata":{},"operation":"LCM_OPERATION","osType":"Linux","requestType":"ARTIFACTINSTALL"}
{"artifactType":"JDK","code":"POST_INSTALL_ACTIONS_EXECUTING","jrePath":"/usr/lib/jvm/jdk-21-oracle-x64/","jreVersion":"21","managedInstance":"jms-demo","metadata":{},"operation":"LCM_OPERATION","osType":"Linux","requestType":"ARTIFACTINSTALL"}
{"artifactType":"JDK","code":"POST_INSTALL_ACTIONS_PRESENT","jrePath":"/usr/lib/jvm/jdk-21-oracle-x64/","jreVersion":"21","managedInstance":"jms-demo","metadata":{},"operation":"LCM_OPERATION","osType":"Linux","requestType":"ARTIFACTINSTALL"}
{"artifactType":"JDK","code":"INSTALL_SUCCESS","jrePath":"/usr/lib/jvm/jdk-21-oracle-x64/","jreVersion":"21","managedInstance":"jms-demo","metadata":{},"operation":"LCM_OPERATION","osType":"Linux","requestType":"ARTIFACTINSTALL"}
{"artifactType":"JDK","code":"COMMAND_RUNNING","jrePath":null,"jreVersion":"21","managedInstance":"jms-demo","metadata":{"attempt":1,"maximumAttempts":3},"operation":"LCM_OPERATION","osType":"Linux","requestType":"ARTIFACTINSTALL"}
{"artifactType":"JDK","code":"COMMAND_CREATED","jrePath":null,"jreVersion":"21","managedInstance":"jms-demo","metadata":{},"operation":"LCM_OPERATION","osType":"Linux","requestType":"ARTIFACTINSTALL"}
 
# verification on the managed instance:
[root@jms-demo ~]# egrep '^https?\.proxy' /usr/lib/jvm/jdk-21-oracle-x64/conf/net.properties
http.proxyHost=my-awesome-company-proxy
http.proxyPort=8080
https.proxyHost=my-awesome-company-proxy
https.proxyPort=8080