How to Install Oracle Java 11 in Ubuntu 18.04/18.10

November 27, 2018

This quick tutorial shows you how to easily install the latest Oracle Java 11 LTS in Ubuntu 18.04, Ubuntu 18.10, Ubuntu 16.04, Ubuntu 14.04 via PPA.

Thanks to the “Linux Uprising” team PPA, an installer script is available to automatically download java package from Oracle web server, and install it in on your system.

UPDATE: Oracle Java 11 can’t be directly downloaded from Oracle website any more! Now you HAVE to log in and manually download Oracle Java 11 .tar.gz, and place the archive in /var/cache/oracle-jdk11-installer-local/

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 asterisks feedback) for sudo prompt and hit Enter.

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

sudo apt-get update

sudo apt-get install oracle-java11-installer-local

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

Before getting started, you must accept the license (press Tab to highlight OK and hit Enter).

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

sudo apt-get install oracle-java11-set-default-local

Finally check Java version via java -version:

Uninstall:

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

sudo apt-get remove oracle-java11-set-default-local

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

27 responses to How to Install Oracle Java 11 in Ubuntu 18.04/18.10

  1. How do you pronounce Ji M? That’s an interesting name? Also thanks for this tutorial very helpful and up to date.

  2. Thanks for this simple step by step

  3. well i got this error : E: Unable to locate package oracle-java11-installer

  4. Cannot add PPA: ‘ppa:~linuxuprising/ubuntu/java’.
    ERROR: ‘~linuxuprising’ user or team does not exist.
    LIKE THIS ERROR COMMING BRO

  5. thank you bro very much, you’re always easy simple and you do it quickly

  6. Hello, im stuck at http request sent,awaiting for response

  7. This is great… but how do auto-accept the license?

    I tried this but it only works for the ppa:webupd8team/java distro, which doesn’t have n oracle-java11-installe roption:

    https://stackoverflow.com/questions/19275856/auto-yes-to-the-license-agreement-on-sudo-apt-get-y-install-oracle-java7-instal

  8. user1@WebServer2:~$ sudo add-apt-repository ppa:linuxuprising/java
    [sudo] password for user1:
    Cannot add PPA: ‘ppa:~linuxuprising/ubuntu/java’.
    ERROR: ‘~linuxuprising’ user or team does not exist.

  9. Thank You For The Help Man This Was A Lifesaver!!!!

  10. Pretty straight forward!….tks…

  11. sudo add-apt-repository ppa:linuxuprising/java
    Cannot add PPA: ‘ppa:~linuxuprising/ubuntu/java’.
    ERROR: ‘~linuxuprising’ user or team does not exist.

    Really don’t know where does that swung dash come from.

  12. Thanks a lot for this, it really very helpful and solved my problem

  13. the PPA no longer exists. all commands return the same sentence just worded differently. that the PPA package does not exist anymore

  14. Thanks that PPA is a real time saver :)

  15. Everything went smooth installing into Ubuntu 18.04 Server. Thanks!

  16. How can i get my java home?

  17. thank you for this post, keep posting.

  18. I also get :

    Unable to locate package oracle-java11-installer

    I am online, on a Lubuntu 18.04 machine. strange.

  19. really this page very useful to install oracle database. thank you

  20. this a very quick and ‘painless’ guide—good job!!!

  21. Naveen Kumar Reddy June 26, 2019 at 4:29 am

    I also get :

    Unable to locate package oracle-java11-installer

    I am online, on a Lubuntu 18.04 machine. strange.

  22. installed oracle-java11-installer-local package post-installation script subprocess returned error exit status 1
    Errors were encountered while processing:
    oracle-java11-installer-local
    E: Sub-process /usr/bin/dpkg returned an error code (1)

  23. How can the JDK be downloaded if terminal only is available? no web to login.