Install Java on Azure Ubuntu Pro 24.04 LTS (Arm64)

In this section, you will install Java on your Arm-based Ubuntu Pro virtual machine. The goal is to ensure you have both the Java Runtime Environment (JRE) for running Java applications and the Java Development Kit (JDK) for compiling code and running benchmarks.

Install OpenJDK (JRE + JDK)

Use the Ubuntu package manager. The default-jdk package installs both the runtime and the compiler.

    

        
        
sudo apt update
sudo apt install -y default-jdk

    

Verify your installation

Confirm the architecture and the installed Java versions:

    

        
        
uname -m
java -version
javac -version

    

You see the version information printed:

    

        
        aarch64
openjdk version "21.0.8" 2025-07-15
OpenJDK Runtime Environment (build 21.0.8+9-Ubuntu-0ubuntu124.04.1)
OpenJDK 64-Bit Server VM (build 21.0.8+9-Ubuntu-0ubuntu124.04.1, mixed mode, sharing)

        
    

Check to ensure that the JDK is properly installed:

    

        
        
which java
which javac

    

The output should look similar to:

    

        
        /usr/bin/java
/usr/bin/javac

        
    

Set the Java Environment Variables to point to the root directory of your JDK installation.

Use a text editor to edit the file $HOME/.bashrc and add the 2 environment variables.

    

        
        
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-arm64
export PATH=$JAVA_HOME/bin:$PATH

    

Source the updated $HOME/.bashrc file.

    

        
        
source ~/.bashrc 

    

Confirm the new settings.

    

        
        
echo $JAVA_HOME
which java
which javac

    

The output is:

    

        
        /usr/lib/jvm/java-21-openjdk-arm64
/usr/lib/jvm/java-21-openjdk-arm64/bin/java
/usr/lib/jvm/java-21-openjdk-arm64/bin/javac

        
    
Note

Ubuntu Pro 24.04 LTS provides OpenJDK 21 by default. Ensure your OpenJDK for Arm64 is 11.0.9 or newer if you must run Java 11; releases before 11.0.9 can suffer performance issues due to false‑sharing cache contention. See the Arm community blog: Java performance on Neoverse N1 . You can also consult the Arm Ecosystem Dashboard for package guidance on Arm Neoverse Linux systems.

Back
Next