- Install the Java Runtime Environment
- What you’ll learn
- What you’ll need
- 2. Installing OpenJDK JRE
- 3. Installing Oracle HotSpot JRE
- Downloading the Oracle HotSpot JRE binaries
- Installing
- Post-installation steps
- Need further assistance?
- Java Downloads
- JDK Development Kit 20.0.2 downloads
- Release information
- JDK Development Kit 17.0.8 downloads
- Release information
- GraalVM for JDK 20.0.2 downloads
- Release information
- GraalVM for JDK 17.0.8 downloads
- Release information
- Protect your investment—and more
- Java SE subscribers have more choices
- Java SE Development Kit 8u381
- JRE 8
- Server JRE 8
- Which Java 8 package do I need?
- Release information
- Java for linux downloads
- Important Oracle JDK License Update
Install the Java Runtime Environment
The Java Runtime Environment (JRE) is required to run Java programs. Nowadays there are many JRE packages available from a variety of projects and companies, but the two most popular on Ubuntu are OpenJDK and Oracle HotSpot. Using one package over the other should not create any functional difference in most applications; however, some prefer OpenJDK over Oracle HotSpot as the former does not contain closed-source components, has a much clearer licensing and support policy, and is maintained as part of the Ubuntu archive, with easier installation and upgrades.
In this guide, we’ll be going through the installation of both JRE packages. Of course, you generally only need to pick the one that best suits your needs and preferences.
What you’ll learn
What you’ll need
That’s all you need. If you have that, let’s proceed to the next step!
2. Installing OpenJDK JRE
With new versions of Java released every 6 months, there are multiple versions available for use. Nowadays, Java 11 is the current Long Term Support (LTS) version, but Java 8 is still widely used. Moreover, the non LTS versions of Java are bringing a steady stream of innovation into the language, and also see some adoption.
Ubuntu offers the default-jre package, which is regularly updated to ship the latest version of the current OpenJDK JRE in Long Term Support (LTS). The default-jre is an excellent choice for most situations, thanks to the outstanding track of backwards compatibility of the Java Virtual Machine.
(Alternatively, you may opt to use a specific Java version, using for example the openjdk-11-jre package; as updates are released for that version of the Java Virtual Machine, that packages will be updated, allowing you to stick to the latest and greatest update of one specific version of the Java language.)
To install the OpenJDK JRE, we run:
sudo apt install default-jre
We can check if OpenJDK JRE was properly installed by running:
It should output the following:
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2, mixed mode)
(Although the output may change in the future as new Java versions are promoted to LTS status, or the current LTS version receives updates.)
In the next step we’ll install Oracle HotSpot JRE.
3. Installing Oracle HotSpot JRE
Downloading the Oracle HotSpot JRE binaries
Download JRE binaries in .tar.gz (tarball) by heading over to their website. An Oracle account is needed to download the Oracle HotSpot JRE.
Oracle does not currently offer JRE packages for Java 11 or above from their website so, for this tutorial, we will use the Oracle HotSpot JRE version to be 8u291 (Java 8, update 291).
Installing
Create a directory to install JRE in with:
Move the JRE binaries into the directory:
sudo mv jre-8u291-linux-x64.tar.gz /usr/local/java
Go into the install directory:
sudo tar zxvf jre-8u291-linux-x64.tar.gz
Post-installation steps
To save space, delete the tarball by running:
sudo rm jre-8u291-linux-x64.tar.gz
Let the system know where JRE is installed:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.8.0_291/bin/java" 1
After that’s done, check the installation by running:
It should output the following:
java version "1.8.0_291" Java(TM) SE Runtime Environment (build 1.8.0_291-b10) Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
Need further assistance?
Java Downloads
JDK 20 is the latest release of Java SE Platform and JDK 17 LTS is the latest long-term support release for the Java SE platform.
JDK Development Kit 20.0.2 downloads
JDK 20 binaries are free to use in production and free to redistribute, at no cost, under the Oracle No-Fee Terms and Conditions.
JDK 20 will receive updates under these terms, until September 2023 when it will be superseded by JDK 21.
Release information
JDK Development Kit 17.0.8 downloads
JDK 17 binaries are free to use in production and free to redistribute, at no cost, under the Oracle No-Fee Terms and Conditions.
JDK 17 will receive updates under these terms, until September 2024, a year after the release of the next LTS.
Release information
GraalVM for JDK 20.0.2 downloads
GraalVM for JDK 20 binaries are free to use in production and free to redistribute, at no cost, under the GraalVM Free Terms and Conditions.
GraalVM for JDK 20 will receive updates under these terms, until September 2023 when it will be superseded by GraalVM for JDK 21.
Oracle GraalVM uses the Graal just-in-time compiler and includes the Native Image feature as optional early adopter technology.
Native Image is extensively tested and supported for use in production, but is not a conformant implementation of the Java Platform. GraalVM for JDK 20 without the Native Image feature included is available for customers at My Oracle Support.
Release information
GraalVM for JDK 17.0.8 downloads
GraalVM for JDK 17 binaries are free to use in production and free to redistribute, at no cost, under the GraalVM Free Terms and Conditions.
GraalVM for JDK 17 will receive updates under these terms, until September 2024, a year after the release of the next LTS.
Oracle GraalVM uses the Graal just-in-time compiler and includes the Native Image feature as optional early adopter technology.
Native Image is extensively tested and supported for use in production, but is not a conformant implementation of the Java Platform. GraalVM for JDK 17 without the Native Image feature included is available for customers at My Oracle Support.
Release information
Script-friendly Download URLs
The URLs listed above will remain the same for update releases to allow their use in scripts.
Protect your investment—and more
Java SE subscribers get support for JDK 17, receive updates until at least October 2029, are entitled to GraalVM Enterprise, Java Management Service, and bundled patch releases (BPRs) with fixes not yet available to nonsubscribers, and more.
Java SE subscribers have more choices
Also available for development, personal use, and to run other licensed Oracle products.
Java SE Development Kit 8u381
Java SE subscribers will receive JDK 8 updates until at least December 2030.
The Oracle JDK 8 license changed in April 2019
The Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK 8 licenses. This license permits certain uses, such as personal use and development use, at no cost — but other uses authorized under prior Oracle JDK licenses may no longer be available. Please review the terms carefully before downloading and using this product. FAQs are available here.
Commercial license and support are available for a low cost with Java SE Universal Subscription.
Java SE 8u381 checksums and OL 8 GPG Keys for RPMs
JRE 8
Java SE Runtime Environment 8u381
Server JRE 8
Server JRE (Java SE Runtime Environment) 8u381
Which Java 8 package do I need?
Software developers: Java SE Development Kit (JDK) For Java developers. Includes a complete JRE plus tools for developing, debugging, and monitoring Java applications.
Running headless Linux workloads at or near your systems’ CPU or memory limits Enterprise Performance Pack brings significant memory and performance improvements including modern garbage collection algorithms, reduced memory usage and many other optimizations. Learn more
Administrators running applications on a server Server Java Runtime Environment (Server JRE). For deploying Java applications on servers. Includes tools for JVM monitoring and tools commonly required for server applications, but does not include browser integration (Java plug-in), auto-update, or an installer. Learn more
End user running Java on a desktop: Java Runtime Environment (JRE) Covers most end-users needs. Contains everything required to run Java applications on your system.
Release information
Java for linux downloads
The JDK is a development environment for building applications using the Java programming language.
The JDK includes tools useful for developing and testing programs written in the Java programming language and running on the Java TM platform.
Important Oracle JDK License Update
The Oracle JDK License has changed for releases starting April 16, 2019.
The new Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK licenses. The new license permits certain uses, such as personal use and development use, at no cost — but other uses authorized under prior Oracle JDK licenses may no longer be available. Please review the terms carefully before downloading and using this product. An FAQ is available here.
Commercial license and support is available with a low cost Java SE Subscription.
Oracle also provides the latest OpenJDK release under the open source GPL License at jdk.java.net.
WARNING: These older versions of the JRE and JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production.
These Java SE 8 update releases are provided under the Java SE OTN License.
Java SE 8u202 and older updates are available, under the Binary Code License (“BCL”).
For production use Oracle recommends downloading the latest JDK and JRE versions and allowing auto-update.
Only developers and Enterprise administrators should download these releases.
Downloading these releases requires an oracle.com account. If you don’t have an oracle.com account you can use the links on the top of this page to learn more about it and register for one for free.
For current Java releases, please consult the Oracle Software Download page.