A more accurate title would be (but it's way too long): install the latest OpenJDK 12, 11, 8 and even 7 in Ubuntu, Debian, Linux Mint, RHEL, or SLES using the free, open source Zulu OpenJDK builds by Azul Systems. DEB, RPM and tar.gz binaries available, as well as apt and yum repositories.
Azul Systems provides tested, certified builds of OpenJDK, under the name of Zulu. Zulu is free and open source software (and freely redistributable), and offers up to date OpenJDK builds of Java 12, 11, 8, and 7.
The Zulu OpenJDK builds are available for Windows, macOS and Linux. On Linux, there are DEB and RPM packages to make it easy to install on Debian, Ubuntu, RHEL, Fedora, Oracle Linux or SLES and so on, as well as .tar.gz binaries, and Alpine Linux specific builds. Repositories are also available, for all Linux distributions mentioned above minus Fedora (it didn't work for me on Fedora 29) and Alpine Linux.
So why use the Zulu OpenJDK builds instead of Oracle Java or OpenJDK?
- The Oracle Java license has changed for releases starting April 16, 2019. The new license only permits certain uses, like personal and development, at no cost, requiring a commercial license for other cases.
- OpenJDK is not always up to date - this depends on the Linux distribution you're using. As an example, Ubuntu 18.10 and 18.04 have OpenJDK 8u191, and Ubuntu 19.04 doesn't even have OpenJDK 8, while the latest Oracle JDK 8 and Zulu JDK 8 is version 8u212. Also, OpenJDK 12 is only available on Ubuntu 19.04. Here's the OpenJDK situation in Ubuntu:
- As reported by an Azul employee, Zulu is ran through the full JCK/TCK to ensure that it complies with the Java SE spec, as defined by the JCP/JSR. What's more, an analysis is ran to ensure that every single compiled file has the correct GPLv2 with CPE license header, guaranteeing that you don't encounter licensing issues when using Zulu OpenJDK builds.
On a Java-related note, the latest Oracle Java 11 release requires logging into an Oracle account to download, so I cannot update the Linux Uprising Java PPA with the latest Oracle Java 11 release. The download links for the version that's currently in the PPA will probably stop working at some point. Oracle Java 12 downloads are still public, but probably that's probably going to change with future updates. One way around this for users would be to create an Oracle account, download the latest Oracle Java version, and use a script like install-java.sh that makes it possible to install any Oracle Java version on Ubuntu, Debian and Fedora.
Download / install Zulu OpenJDK 12, 11, 8 or 7 in Ubuntu, Debian, Linux Mint, RHEL, etc.
Zulu OpenJDK 12, 11, 8 or 7 builds for Windows, macOS and Linux can be downloaded from this page. On Linux there are binaries available as DEB, RPM and .tar.gz (64bit).
Zulu OpenJDK is also available in repositories (for 64bit only) provided by Azul Systems, for Debian, Ubuntu and other Debian or Ubuntu based Linux distributions like Linux Mint, elementary OS and so on, as well as RHEL, Oracle Linux or SLES.
The repositories retain older package versions, so for example, you can downgrade the package to the version that was available before the last update, in case something goes wrong with the latest release. See how to downgrade packages (in general) on Debian or Ubuntu.
Both the DEB / RPM packages and the repositories packages update the Java alternatives in order to make Zulu OpenJDK default. If you are using the "oracle-java12-installer" (or older) on Debian/Ubuntu, you must remove the "oracle-java12-installer-set-default" package to get Zulu OpenJDK to be the default system Java.
The Zulu OpenJDK packages do not include desktop integration, so you won't find any OpenJDK desktop files in your application menu, or have the option of opening some JAR file from the file manager with Zulu OpenJDK.
Import the Zulu repository key and add the Zulu repository as follows:
- Ubuntu, Linux Mint, and other Ubuntu-based Linux distributions that support add-apt-repository:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
sudo apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main'
- Debian:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
echo "deb http://repos.azulsystems.com/debian stable main" | sudo tee /etc/apt/sources.list.d/zulu.list
- RHEL or Oracle Linux:
sudo rpm --import http://repos.azulsystems.com/RPM-GPG-KEY-azulsystems
sudo curl -o /etc/yum.repos.d/zulu.repo http://repos.azulsystems.com/rhel/zulu.repo
- SLES (might also work in openSUSE - not tested):
sudo rpm --import http://repos.azulsystems.com/RPM-GPG-KEY-azulsystems
sudo zypper addrepo http://repos.azulsystems.com/sles/latest zulu
Now you can install one of the Zulu OpenJDK builds provided by Azul Systems:
- Debian, Ubuntu, Linux Mint and Debian or Ubuntu based Linux distributions:
sudo apt install zulu-<version>
- RHEL or Oracle Linux:
sudo yum install zulu-<version>
- SLES:
sudo zypper install zulu-<version>
In all cases above, <version> is the Zulu OpenJDK version, which can be 12, 11, 8 or 7 (so the package names are: zulu-12, zulu-11, zulu-8 and zulu-7).
Extra Zulu OpenJDK links you may find useful:
- There are also open source builds of Zulu with OpenJFX (11 and 8), but those only come in archives, and not as DEB or RPM packages.
- Exporting the Zulu OpenJDK JAVA_HOME
- Switching Java versions (using update-alternatives)
- Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for Zulu OpenJDK (called CEK, or Zulu Cryptography Extension Kit
- Zulu Embedded (Zulu OpenJDK builds for ARM, including Raspberry Pi)