How to install Java on Ubuntu 19.10 Eoan Ermine Linux

In this artcile we will discuss a procedure on how to install OpenJDK and OracleJDK java on Ubuntu 19.10 Eoan Ermine Linux.

In this tutorial you will learn:

  • How to install OpenJDK Java
  • How to install OracleJDK Java
  • How to switch between Java versions
  • How to check java version

Java on Ubuntu 19.10 Eoan Ermine Linux

Java on Ubuntu 19.10 Eoan Ermine Linux

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu 19.10 Eoan Ermine Linux
Software OpenJDK 8,11,13,14 and OracleJDK 12,13
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install OpenJDK Java on Ubuntu 19.10 step by step instructions

By default the Ubuntu 19.10 Eoan Ermine Linux offers multiple versions of Java OpenJDK. The OpenJDK versions 8,11,13 and 14 are available from a standard Ubuntu repository.

  1. Search for available OpenJDK versions:

    Unless you already know which version of OpenJDK you wish to install, then as a first step perform a search of all available packages:

    $ apt search openjdk
    


  2. Install OpenJDK:

    Once ready, install any of the available OpenJDK java versions. For example:

    $ sudo apt install openjdk-8-jdk
    OR
    $ sudo apt install openjdk-11-jdk
    OR
    $ sudo apt install openjdk-13-jdk
    OR
    $ sudo apt install openjdk-14-jdk
    
  3. Confirm installation:

    At this stage the java command should be available on your system and return your installed version:
    $ java --version
    openjdk 14-ea 2020-03-17
    OpenJDK Runtime Environment (build 14-ea+18-Ubuntu-1)
    OpenJDK 64-Bit Server VM (build 14-ea+18-Ubuntu-1, mixed mode, sharing)
    

    Additionally test your java installation by compiling Java Hello World program.

  4. Switch between installed versions:

    To switch between version execute the following two command while selecting the Java version you require:

    $ sudo update-alternatives --config java
    $ sudo update-alternatives --config javac
    

How to install Oracle Java JDK on Ubuntu 19.10 step by step instructions

Perform the following steps to install the Oracle Java JDK.



  1. Add 3rd party repository:
    $ sudo add-apt-repository ppa:linuxuprising/java
    
  2. Install Oracle JDK:

    Depending on your desired Java version execute one of the bellow command in order to install Oracle JDK java on your system:

    $ sudo apt install oracle-java12-set-default
    OR
    $ sudo apt install oracle-java13-set-default
    
  3. $ java --version
    openjdk 14-ea 2020-03-17
    OpenJDK Runtime Environment (build 14-ea+18-Ubuntu-1)
    OpenJDK 64-Bit Server VM (build 14-ea+18-Ubuntu-1, mixed mode, sharing)
    

    Additionally test your java installation by compiling Java Hello World program.



  4. Switch between Java Versions:

    To switch between installed Java versions simply reinstall the desired Java package. For example to change from Java version 13 to version 12 execute:

    $ sudo apt install oracle-java12-set-default