Setting up the right Java version in a cloud-based development environment is an important task that many developers run into. Until recently, Oracle Cloud Infrastructure (OCI) Cloud Shell supported only a limited set of pre-installed Java runtimes. If you needed a different version—say for testing compatibility, debugging, or aligning with production environments—you were required to manually download, upload, extract, and configure the runtime.

This manual process was not just tedious but also error-prone. To address this challenge, a more robust and automated solution was introduced to simplify and automate the process of acquiring and configuring Java runtimes within OCI Cloud Shell.


Introducing the Java Download Toolkit for Cloud Shell

The Java Download Toolkit is a simple CLI-based utility that allows developers to download and configure any recent Oracle Java runtime version directly within OCI Cloud Shell. It uses the Java Download APIs of Java Management Service (JMS) to securely retrieve and install Java runtimes—both Long Term Support (LTS) and non-LTS versions.

Why It Matters?

  • Saves time: No more uploading and unpacking archives manually
  • Increases flexibility: Choose any version you need, including archived versions from the past two years
  • Reduces errors: Guided CLI workflow eliminates guesswork
  • Improves compliance: All downloads are token-authenticated and tracked using JMS APIs

Getting Started

The Java Download Toolkit script is already available in your Cloud Shell.

Prerequisites: An active OCI tenancy and access to Cloud Shell

You can start the toolkit by running:

jms-java-download.sh

Selecting a Java Version

Once the script is executed, you’ll see a list of the most current Oracle Java releases:

Current Java Versions:
1)  24.0.1
2)  21.0.7
3)  17.0.15
...
6)  Show Archived Versions
Enter the number corresponding to the version to install:

You can choose a current release or browse archived versions (useful for debugging or legacy application support). Older versions come with a caution: they are not updated with the latest security patches and should not be used in production.


Token Management and Licensing

Each download is secured via a token, managed through the JMS Java Download feature. Depending on your selection:

  • If a valid token already exists, the script will prompt you to reuse it.
  • If not, you’ll be guided to create a new one.

Tokens ensure that your download is tracked and compliant with Oracle’s No-Fee Terms and Conditions (NFTC) or Oracle Technology Network (OTN) License Agreement for Oracle Java SE license terms.


Automatic Setup

Once the download completes, the toolkit automatically sets the JAVA_HOME and updates your PATH. It also handles cleanup of previously installed versions if needed.

Sample output: 

JAVA_HOME and PATH updated in /home/{username}/.java_env.
Run 'source ~/.bashrc' to apply changes.

You can immediately start using the installed Java version: 

java --version

Start Exploring Today! 

The Java Download Toolkit makes it much easier for Java developers to work in OCI Cloud Shell. By leveraging the Java Download APIs from JMS, it streamlines what used to be a multi-step manual process into a guided, secure, and compliant workflow.

Try it out the next time you spin up Cloud Shell and need a specific Java version.

For more details, refer to: