How to Install Oracle JDK 12 on Ubuntu 18.04 Bionic LTS

April 15, 2019 | By the+gnu+linux+evangelist.

Installing

  1. 2. Downloading Oracle JDK 12

    Download Oracle JDK 12 GNU/Linux Package

  2. 3. Installing Oracle JDK 12

    Then to Setup Oracle JDK 12 on Ubuntu 18.04
    First, Access the Target, usually in the Downloads folder:
    (But if downloaded with Firefox it can be instead into /tmp/mozilla*)

    cd && cd Downloads

    Now to Confirm the Package is there do:

    ls .

    Finally, to Install JDK 12 simply:

    sudo dpkg -i jdk-12*.deb
  3. 4. Setting Up Oracle JDK 12

    Now to Install JDK 12 into System

    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-12/bin/java 1065
    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-12/bin/javac 1065
    sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-12/bin/jar 1065
  4. 5. Switching to Java 12

    Finally, to Switch Java to JDK 12
    This is Valid only if you have to Manage more than One Java Releases:

    sudo update-alternatives --config java

Choose the Number entry corresponding to Oracle JDK 12!
And for the Java Compiler instead:

sudo update-alternatives --config javac

Choose the Number entry corresponding to Oracle JDK 12.
Test your Java 12 Installation:

java --version

Contents


Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,