Skip to content

Instantly share code, notes, and snippets.

@developer-vs
Last active October 20, 2020 05:50
Show Gist options
  • Save developer-vs/857bb3681e3ae0cb11f2e0b6db0fa2ca to your computer and use it in GitHub Desktop.
Save developer-vs/857bb3681e3ae0cb11f2e0b6db0fa2ca to your computer and use it in GitHub Desktop.
How to install Oracle Java 13 (JDK 13) on Ubuntu

Oracle JDK

Important notice regarding Oracle Java 11 and newer: the Oracle JDK license has changed 
starting April 16, 2019. 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. 

A FAQ is available here: 
https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html . 

About Oracle Java 10: This version reached the end of public updates, therefore it's no longer 
available for download.

Oracle JDK 13 (64bit only!!)

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

Java version 8

sudo add-apt-repository ppa:webupd8team/java
sudo apt update

Java version 10

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update

To install Java 8 execute:

sudo apt install oracle-java8-set-default

To install Java 10 execute :

sudo apt install oracle-java10-set-default

To make Oracle Java 13 default, install the "oracle-java13-set-default" in case it wasn't automatically installed by the Oracle Java 13 installer:

sudo apt install oracle-java13-set-default

To skip installing the "oracle-java13-set-default" package when installing oracle-java13-installer, use:

sudo apt install --no-install--recommends oracle-java13-installer

Don't want Oracle Java 13 to be default any more, but want to have it installed? Remove the oracle-java13-set-default package:

sudop apt remove oracle-java13-set-default

Managing Java Alternatives

You can have multiple Java installations on one server. You can configure which version is the default for use on the command line by using the update-alternatives command.

sudo update-alternatives --config java

You can do this for other Java commands, such as the compiler (javac):

sudo update-alternatives --config javac

List your current java environment variable settings:

sudo update-alternatives --get-selections | grep ^java

Open JDK

To install Java Open JDK version 11:

sudo apt install openjdk-11-jdk

To install Java Open JDK version 11:

sudo apt install openjdk-8-jdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment