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

Oracle Java logo

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 has been out for some time, and seeing that Andrew hasn't updated the Java PPA with the new version, I decided to create a PPA for it myself. 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 install it on 32bit or ARM because it won't work!

The PPA package installs Oracle JDK 10, which includes JRE.

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

To add the LinuxUprising Java PPA repository 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

In Ubuntu, Oracle Java 10 should be automatically set as default. In other Linux distributions, like Linux Mint, you can make Oracle JDK 10 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 default, you should see an output similar to the following:

java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)

You can try it for javac as well:

javac -version

Which should return an output similar to the one below:

javac 10

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 lincense (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 accepts 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

No comments:

Powered by Blogger.