Install Oracle Java 10 In Ubuntu Or Linux Mint From PPA Repository

Update: Oracle Java 10 has reached the end of public updates (see the roadmap here), therefore it's no longer available for download. As a result, the packages in the Linux Uprising Java PPA no longer work. Switch to Oracle Java 11 (which is in the Linux Uprising PPA and is a long term release), the latest Oracle Java 14, or OpenJDK (you may also use AdoptOpenJDK or ZuluJDK) instead.

Oracle Java Development Kit 10 includes new features like:
  • an experimental just-in-time compiler called Graal can be used on the Linux/x64 platform
  • local-variable type inference.
  • application class-data sharing, which allows app classes to be placed in the shared archive to reduce startup and footprint of Java applications.
  • Docker awareness - on Linux, JVM now automatically detects if running in a Docker container
  • various other changes.

Oracle Java 10 for Linux has been out for some time, and seeing that Andrew hasn't updated the Java PPA (Personal Package Archive) with the new version, I decided to create a single repository PPA for it myself (Oracle Java is the only package in the PPA). My package is pretty much the same as the Java 9 and 8 packages from the WebUpd8 Java PPA, the only change being that it was updated to install Oracle Java 10 (JDK 10).

Oracle provides Java (JDK) 10 for 64bit only. As a result, using the Oracle Java 10 package in our PPA will only work on 64bit, so don't try to add the PPA to your software sources or install it on 32bit or ARM because it won't work!

The PPA package installs Oracle JDK 10 for Linux, which includes the JRE bin Java folder, so installing this package gets you both JDK and JRE. In some old Linux versions, the JRE bin Java folder was available in JDK, but in a separate folder. This Oracle Java version uses the same folder for all executables, be it JDK or JRE, and there's no need to install JRE separately.

Install Oracle Java 10 (JDK 10) in Ubuntu or Linux Mint from PPA

Oracle Java 10 installer ubuntu

For Debian, see the instructions from our Debian Oracle JDK 10 article.

To add the LinuxUprising Java PPA repository to your software sources and install Oracle Java 10 in Ubuntu or Linux Mint (64bit only) you can use the commands below:

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java10-installer

The package name is oracle-java10-installer and not oracle-java10-jdk because it doesn't contain any Oracle Java files. It's just an installer that downloads the binary from Oracle's servers and configures everything automatically for you.

After adding our Oracle Java PPA to your software sources and installing Java, here's how to make it as default. Don't worry though, there's no need to manually run commands like sudo update-alternatives --config java or anything like that.

In Ubuntu, Oracle Java 10 should be automatically set as default. In other Linux distributions, like Linux Mint, you can make Oracle JDK 10 for Linux as default by installing the oracle-java10-set-default package:

sudo apt install oracle-java10-set-default

If you want to have Oracle Java 10 installed but not set it as the default Java, make sure the oracle-java10-set-default package is not installed / removed:

sudo apt remove oracle-java10-set-default

You can check to see if Oracle Java 10 is set as default by checking your current Java version using the following command:

java -version

If Oracle Java 10 is set as default, you should see an output similar to the following:

java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

You can try it for javac as well:

javac -version

Which should return an output similar to the one below:

javac 10.0.2

Just like the original package, my Oracle Java 10 package supports installing Java by downloading the archive manually. This is useful in case you're behind a firewall or your ISP somehow blocks the Oracle JDK 10 download link. To do this, download the Oracle Java 10 tar.gz archive and place it in the /var/cache/oracle-jdk10-installer folder. Next, install the oracle-java10-installer package and it should pick up the downloaded tar.gz archive instead of downloading it by itself.

Automatically accept the Oracle Java 10 license (for automated installations)

By default, the Oracle Java 10 installer prompts you to accept the Oracle Java license before proceeding with the JDK 10 installation. If you want to automate the Oracle Java 10 installation process, use the following command to automatically accept the license:

echo oracle-java10-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

If the command above doesn't automatically accept the Oracle Java 10 license, try the command below instead:

echo oracle-java10-installer shared/accepted-oracle-licence-v1-1 boolean true | sudo /usr/bin/debconf-set-selections