OpenJDK is the open-source reference implementation of Java. This guide covers the OpenJDK 8 download and install steps for Debian, Ubuntu, Fedora, Red Hat, and Oracle Linux, plus how to grab JDK 9 and newer builds when you need them. Commands change slightly by distribution, so pick the section that matches your system.

What to Know Before Your OpenJDK 8 Download

OpenJDK ships in two forms. The JRE (Java Runtime Environment) runs Java programs. The JDK (Java Development Kit) bundles the JRE with a compiler and the tools you need to write and compile Java code.

Developers need the JDK. If you only run Java apps, the JRE is enough. That single choice decides which package you install below.

OpenJDK 8 (JDK) 172 MB JRE 8 46 MB
Red Hat’s OpenJDK 8 build (release 8u492, Windows x64). The JDK archive is roughly four times the JRE because it carries the compiler and developer tools.

OpenJDK 8 Download on Debian and Ubuntu

Open a terminal and install just the runtime:

sudo apt-get install openjdk-8-jre

To write or compile Java programs, install the development kit instead:

sudo apt-get install openjdk-8-jdk

The openjdk-8-jre package gives you everything needed to run Java apps. The openjdk-8-jdk package adds the compiler and other development tools on top. If you want to see every flag the installer accepts, this apt-get command options reference breaks them down.

On newer releases you can swap in the APT package tool and run sudo apt install openjdk-8-jdk for the same result.

OpenJDK 8 Download on Fedora, Red Hat, and Oracle Linux

On rpm-based distributions, install the runtime with:

su -c "yum install java-1.8.0-openjdk"

For development tools, run:

su -c "yum install java-1.8.0-openjdk-devel"

The package names differ from Debian systems, but the split between runtime and development packages works the same way.

Downloading JDK 9 and Later Versions

For JDK 9 and newer, binary builds live on release-specific pages at jdk.java.net. Each version has its own page. JDK 13 binaries, for example, were posted at jdk.java.net/13. Archives come as .tar.gz or .zip depending on your platform.

Extract a .tar.gz file with:

tar xvf openjdk-13*_bin.tar.gz

Or for a zip archive:

unzip openjdk-13*_bin.zip

The wildcard handles version-specific suffixes for you. If the options are new to you, this tar command reference covers the extraction flags, and this guide to extract zip archives on Linux does the same for .zip files.

OpenJDK Package Names by Version

JDK VersionDebian / UbuntuRPM-Based
JDK 6openjdk-6-jre / openjdk-6-jdkjava-1.6.0-openjdk / java-1.6.0-openjdk-devel
JDK 7openjdk-7-jre / openjdk-7-jdkjava-1.7.0-openjdk / java-1.7.0-openjdk-devel
JDK 8openjdk-8-jre / openjdk-8-jdkjava-1.8.0-openjdk / java-1.8.0-openjdk-devel
JDK 9+Download from jdk.java.netDownload from jdk.java.net

Installing Older JDK Versions

JDK 7 on Debian or Ubuntu:

sudo apt-get install openjdk-7-jre
sudo apt-get install openjdk-7-jdk

JDK 7 on Fedora or Red Hat:

su -c "yum install java-1.7.0-openjdk"
su -c "yum install java-1.7.0-openjdk-devel"

JDK 6 on Debian or Ubuntu:

sudo apt-get install openjdk-6-jre
sudo apt-get install openjdk-6-jdk

JDK 6 on Fedora or Red Hat:

su -c "yum install java-1.6.0-openjdk"
su -c "yum install java-1.6.0-openjdk-devel"

In every pair, the -devel or -jdk package is the one that adds the compiler.

OpenJDK on BSD Systems

For BSD-based systems including DragonFly BSD, FreeBSD, macOS, NetBSD, and OpenBSD, the BSD Port project maintains a list of available packages. The OpenJDK BSD porting project wiki at wiki.openjdk.org/display/BSDPort/Main points to the right package for each platform.

After extracting a JDK archive by hand on these systems, you may need to mark the binaries executable. This walkthrough on setting file permissions with chmod shows how the read, write, and execute bits work.

FAQs

Is the OpenJDK 8 download free?

Yes. OpenJDK 8 is open-source and free to download, use, and redistribute under the GNU GPL with a classpath exception. No license fee or subscription applies for either the JRE or the JDK.

Should I install the JRE or the JDK?

Install the JDK if you write or compile Java code, since it includes the compiler. Install the JRE if you only run Java applications. The JDK contains the JRE, so developers never need both.

How do I check my installed OpenJDK version?

Run java -version in a terminal. It prints the OpenJDK release, such as 1.8.0_322, along with the runtime and server VM build numbers. An error usually means Java is not on your PATH.

What is the difference between OpenJDK and Oracle JDK?

Both build from the same source. OpenJDK is free for any use. Oracle JDK adds commercial support and, for some uses, requires a paid Java SE subscription under Oracle’s license terms.

Where do I download JDK 9 or later?

Get JDK 9 and newer from version-specific pages at jdk.java.net, one page per release. Download the .tar.gz or .zip for your platform, then extract it with tar or unzip.

Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.