How to Install Oracle Java 12 in Ubuntu 18.04 / 16.04

March 25, 2019 — 7 Comments

Oracle Java 12 was released a few days ago. Now you can easily install it via PPA in Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04, Ubuntu 18.10, and higher.

An installer script was create to make installing Oracle Java 12 easy in Ubuntu. It automatically downloads java package from Oracle web server, and installs it on your system. The “Linux Uprising” team PPA maintains the installer script for all current Ubuntu releases.

1. To add the PPA, open terminal either from app launcher or by pressing Ctrl+Alt+T on keyboard. When it opens, run command:

sudo add-apt-repository ppa:linuxuprising/java

Type user password (no asterisk feedback due to security reason) for sudo prompt and hit Enter.

2. Then run commands to install the script to start downloading and installing Java 12 on your Ubuntu:

sudo apt-get update

sudo apt-get install oracle-java12-installer

For Ubuntu 18.04 and higher, skip sudo apt-get update command since it’s done automatically after adding PPA.

3. If you have installed multiple Java versions, install (or remove) oracle-java12-set-default package to set (or not set) Java 12 as default.

sudo apt-get install oracle-java12-set-default

Finally check Java version via java -version:

Uninstall:

To remove Oracle Java 12, run command to remove the installer script:

sudo apt-get remove oracle-java12-installer

And go to Software & Updates -> Other Software to remove the PPA repository.

I'm a freelance blogger who started using Ubuntu 5+ years ago and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me on Google Plus or email to ubuntuhandbook1@gmail.com

7 responses to How to Install Oracle Java 12 in Ubuntu 18.04 / 16.04

  1. Works on Kubuntu 18.04, You da man.

  2. Aniruddh Joshi April 27, 2019 at 1:59 pm

    Step 3 does not set java 12 as default

  3. Thanks a lot :)

  4. Well done Ji!

  5. Mohamed Jebali July 9, 2019 at 6:13 pm

    Straight forward, Thank you!

  6. download failed
    Oracle JDK 12 is NOT installed.
    dpkg: error processing package oracle-java12-installer (–configure):
    installed oracle-java12-installer package post-installation script subprocess returned error exit status 1
    Errors were encountered while processing:
    oracle-java12-installer
    E: Sub-process /usr/bin/dpkg returned an error code (1)

  7. This install method doesn’t work on July 20th. Doesn’t Oracle updated Java 12 to Java 13??

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*