Java Runtime Environment (JRE) is required to run Java applications on Ubuntu. JRE includes the Java Virtual Machine (JVM), which executes Java code, and libraries necessary for running Java programs. There are two main sources for JRE: OpenJDK, an open-source implementation, and Oracle, the official version. OpenJDK's JRE is available through Ubuntu's package manager, apt, while Oracle's JRE requires manual installation.
OpenJDK's JRE is sufficient for most users who need to run Java applications. It is also readily available in Ubuntu's default repositories, making installation straightforward. However, multiple versions are available, such as Java 11 or Java 8, and choosing the right one depends on the specific requirements of the Java programs you need to run.
Oracle's JRE can be installed if you need the official version, but this requires manual steps. If you're just running Java applications, the JRE alone is enough. For development purposes, you would need the Java Development Kit (JDK), which includes the JRE by default.
Related: How to install JDK on Ubuntu
Steps to install Java Runtime Environment (JRE) on Ubuntu:
- Open the terminal.
- Update the apt package list.
$ sudo apt update [sudo] password for user: Hit:1 http://ports.ubuntu.com/ubuntu-ports kinetic-security InRelease Hit:2 http://us.ports.ubuntu.com/ubuntu-ports kinetic InRelease Hit:3 http://us.ports.ubuntu.com/ubuntu-ports kinetic-updates InRelease Hit:4 http://us.ports.ubuntu.com/ubuntu-ports kinetic-backports InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done 6 packages can be upgraded. Run 'apt list --upgradable' to see them.
- Install the default JRE package.
$ $ sudo apt install --assume-yes default-jre Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: ca-certificates-java default-jre-headless fonts-dejavu-extra java-common libatk-wrapper-java libatk-wrapper-java-jni openjdk-11-jre openjdk-11-jre-headless Suggested packages: fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei The following NEW packages will be installed: ca-certificates-java default-jre default-jre-headless fonts-dejavu-extra java-common libatk-wrapper-java libatk-wrapper-java-jni openjdk-11-jre openjdk-11-jre-headless 0 upgraded, 9 newly installed, 0 to remove and 6 not upgraded. Need to get 43.2 MB of archives. After this operation, 179 MB of additional disk space will be used. ##### snipped
- Verify the JRE installation by checking the version.
$ java -version openjdk version "11.0.17" 2022-10-18 OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu2) OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu2, mixed mode)
- Search for available JRE versions in the repository.
$ sudo apt-cache search openjdk | grep "jre\ " openjdk-11-jre - OpenJDK Java runtime, using Hotspot JIT default-jre - Standard Java or Java compatible Runtime openjdk-17-jre - OpenJDK Java runtime, using Hotspot JIT openjdk-18-jre - OpenJDK Java runtime, using Hotspot JIT openjdk-19-jre - OpenJDK Java runtime, using Hotspot JIT openjdk-20-jre - OpenJDK Java runtime, using Hotspot JIT openjdk-8-jre - OpenJDK Java runtime, using Hotspot JIT
- Install a specific JRE version if needed.
$ sudo apt install --assume-yes openjdk-20-jre Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: openjdk-20-jre-headless Suggested packages: fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei The following NEW packages will be installed: openjdk-20-jre openjdk-20-jre-headless 0 upgraded, 2 newly installed, 0 to remove and 6 not upgraded. Need to get 49.4 MB of archives.
- Set the default JRE version if multiple are installed.
$ sudo update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-20-openjdk-arm64/bin/java 2011 auto mode 1 /usr/lib/jvm/java-11-openjdk-arm64/bin/java 1111 manual mode 2 /usr/lib/jvm/java-20-openjdk-arm64/bin/java 2011 manual mode Press <enter> to keep the current choice[*], or type selection number: 1 update-alternatives: using /usr/lib/jvm/java-11-openjdk-arm64/bin/java to provide /usr/bin/java (java) in manual mode
- Verify the default JRE version is set.
$ java --version openjdk 11.0.17 2022-10-18 OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu2) OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu2, mixed mode)
This guide is tested on Ubuntu:
Version | Code Name |
---|---|
22.04 LTS | Jammy Jellyfish |
23.10 | Mantic Minotaur |
24.04 LTS | Noble Numbat |

Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.