Install Oracle Java 10 In Ubuntu Or Linux Mint From PPA Repository

Update: Oracle Java 10 has reached the end of public updates (see the roadmap here), therefore it's no longer available for download. As a result, the packages in the Linux Uprising Java PPA no longer work. Switch to Oracle Java 11 (which is in the Linux Uprising PPA) or OpenJDK 11 instead.

Oracle Java Development Kit 10 includes new features like:
  • an experimental just-in-time compiler called Graal can be used on the Linux/x64 platform
  • local-variable type inference.
  • application class-data sharing, which allows app classes to be placed in the shared archive to reduce startup and footprint of Java applications.
  • Docker awareness - on Linux, JVM now automatically detects if running in a Docker container
  • various other changes.

Oracle Java 10 for Linux has been out for some time, and seeing that Andrew hasn't updated the Java PPA (Personal Package Archive) with the new version, I decided to create a single repository PPA for it myself (Oracle Java is the only package in the PPA). My package is pretty much the same as the Java 9 and 8 packages from the WebUpd8 Java PPA, the only change being that it was updated to install Oracle Java 10 (JDK 10).

Oracle provides Java (JDK) 10 for 64bit only. As a result, using the Oracle Java 10 package in our PPA will only work on 64bit, so don't try to add the PPA to your software sources or install it on 32bit or ARM because it won't work!

The PPA package installs Oracle JDK 10 for Linux, which includes the JRE bin Java folder, so installing this package gets you both JDK and JRE. In some old Linux versions, the JRE bin Java folder was available in JDK, but in a separate folder. This Oracle Java version uses the same folder for all executables, be it JDK or JRE, and there's no need to install JRE separately.

Install Oracle Java 10 (JDK 10) in Ubuntu or Linux Mint from PPA


Oracle Java 10 installer ubuntu

For Debian, see the instructions from our Debian Oracle JDK 10 article.

To add the LinuxUprising Java PPA repository to your software sources and install Oracle Java 10 in Ubuntu or Linux Mint (64bit only) you can use the commands below:

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

The package name is oracle-java10-installer and not oracle-java10-jdk because it doesn't contain any Oracle Java files. It's just an installer that downloads the binary from Oracle's servers and configures everything automatically for you.

After adding our Oracle Java PPA to your software sources and installing Java, here's how to make it default. Don't worry though, there's no need to manually run commands like sudo update-alternatives --config java or anything like that.

In Ubuntu, Oracle Java 10 should be automatically set as default. In other Linux distributions, like Linux Mint, you can make Oracle JDK 10 for Linux as default by installing the oracle-java10-set-default package:

sudo apt install oracle-java10-set-default

If you want to have Oracle Java 10 installed but not set it as the default Java, make sure the oracle-java10-set-default package is not installed / removed:

sudo apt remove oracle-java10-set-default

You can check to see if Oracle Java 10 is set as default by checking your current Java version using the following command:

java -version

If Oracle Java 10 is default, you should see an output similar to the following:

java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

You can try it for javac as well:

javac -version

Which should return an output similar to the one below:

javac 10.0.2

Just like the original package, my Oracle Java 10 package supports installing Java by downloading the archive manually. This is useful in case you're behind a firewall or your ISP somehow blocks the Oracle JDK 10 download link. To do this, download the Oracle Java 10 tar.gz archive and place it in the /var/cache/oracle-jdk10-installer folder. Next, install the oracle-java10-installer package and it should pick up the downloaded tar.gz archive instead of downloading it by itself.

Automatically accept the Oracle Java 10 lincense (for automated installations)


By default, the Oracle Java 10 installer prompts you to accept the Oracle Java license before proceeding with the JDK 10 installation. If you want to automate the Oracle Java 10 installation process, use the following command to automatically accept the license:

echo oracle-java10-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

If the command above doesn't automatically accepts the Oracle Java 10 license, try the command below instead:

echo oracle-java10-installer shared/accepted-oracle-licence-v1-1 boolean true | sudo /usr/bin/debconf-set-selections

39 comments:

  1. Thanks for the package. Why does it conflict with the openjdk java?

    sudo apt install openjdk-11-jre
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following package was automatically installed and is no longer required:
    gsfonts-x11
    Use 'sudo apt autoremove' to remove it.
    The following additional packages will be installed:
    openjdk-11-jre-headless
    Suggested packages:
    fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei
    | fonts-wqy-zenhei
    The following packages will be REMOVED:
    oracle-java10-installer
    The following NEW packages will be installed:
    openjdk-11-jre openjdk-11-jre-headless
    0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
    Need to get 39.6 MB of archives.
    After this operation, 183 MB of additional disk space will be used.
    Do you want to continue? [Y/n]

    ReplyDelete
    Replies
    1. I don't know, the conflict is not added in my package, but in the openjdk package.

      Delete
    2. After some investigation, it looks like the oracle-java-8-installer and probably java-9 as well (which is what I've used to create this new pacckage), automatically incremented the Java priority a while back. The old Oracle Java 8 package mentions: "The priority is no longer incremented by the package (due to complaints by the Debian packagers)".

      That changelog line is from 2016, so that's when it was fixed by the original packager, and thus, it should be fixed in this oracle-java10-installer as well. I guess the Debian maintainers never got the memo...

      Delete
  2. Replies
    1. All I can say is that it is safe, but I'm not sure how to prove that. I mean, security issues can occur even with the official Ubuntu Snap Store: https://www.linuxuprising.com/2018/05/malware-found-in-ubuntu-snap-store.html ...

      This PPA uses the exact same scripts as the Oracle Java WebUpd8 PPA, but modified by me to install Oracle Java 10.

      Delete
    2. What I can prove is that the PPA has many users (currently about 27700) and I didn't get any complaints so far :-) Here's a screenshot: https://imgur.com/a/NdeHK3R

      You can check this for yourself by using the python script from here, which displays the PPA usage statistics. To use it, install python-launchpadlib and python-tabulate:

      sudo apt install python-launchpadlib python-tabulate

      Now you can see the usage statistics for the Linux Uprising Java PPA with:

      python ppastats.py linuxuprising java

      That's all I could think of. I'm not sure what else I can do...

      Delete
    3. I was linked here from the WebUpd8 team, which is official Canonical. That's trustworthy for me.

      Delete
  3. Really pleased to see someone has picked up the reins from WebUpd8 team... But going one further: AdoptOpenJDK could really do with a PPA backing the various flavours and versions... (specifically for OpenJ9... Azul Zulu already provides a repo)

    Regardless - thank you for the endeavour


    https://adoptopenjdk.net

    http://zulu.org/zuludocs-folder/#ZuluUserGuide/PrepareZuluPlatform/AttachAPTRepositoryUbuntuOrDebianSys.htm

    ReplyDelete
    Replies
    1. Unfortunately I don't have the time to maintain more PPAs, at least right now.

      Delete
  4. Works like a charm!! Thanks for sharing.

    ReplyDelete
  5. Hi there, I'm having trouble installing. It appears that a new version of JDK has been released (10.0.2+13), which has broken the installer. See below logs:

    vagrant@vagrant-ubuntu-trusty-64:~/java/DEBIAN$ sudo apt-get install oracle-java10-installer
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    oracle-java10-installer is already the newest version.
    The following package was automatically installed and is no longer required:
    libvpx1
    Use 'apt-get autoremove' to remove it.
    0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Setting up oracle-java10-installer (10.0.1-1~linuxuprising+1) ...
    Using wget settings from /var/cache/oracle-jdk10-installer/wgetrc
    Downloading Oracle Java 10...
    --2018-07-17 22:42:08-- http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz
    Resolving download.oracle.com (download.oracle.com)... 23.204.152.128
    Connecting to download.oracle.com (download.oracle.com)|23.204.152.128|:80... connected.
    HTTP request sent, awaiting response... 302 Moved Temporarily
    Location: https://edelivery.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz [following]
    --2018-07-17 22:42:08-- https://edelivery.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz
    Resolving edelivery.oracle.com (edelivery.oracle.com)... 104.70.67.206, 2001:559:19:3081::2d3e, 2001:559:19:3086::2d3e
    Connecting to edelivery.oracle.com (edelivery.oracle.com)|104.70.67.206|:443... connected.
    HTTP request sent, awaiting response... 302 Moved Temporarily
    Location: http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz?AuthParam=1531867448_f32b938ceacc6a17c650c1f7a9da7b7d [following]
    --2018-07-17 22:42:09-- http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz?AuthParam=1531867448_f32b938ceacc6a17c650c1f7a9da7b7d
    Connecting to download.oracle.com (download.oracle.com)|23.204.152.128|:80... connected.
    HTTP request sent, awaiting response... 404 Not Found
    2018-07-17 22:42:22 ERROR 404: Not Found.

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

    ReplyDelete
    Replies
    1. A new Oracle Java 10 version was just released and it seems they remove old releases. I'm currently working on the update for the new 10.0.2 version.

      Delete
    2. The packages have now been updated to the latest Oracle Java 10.0.2 so the installer should work now. Run this to install it:

      sudo apt update
      sudo apt install oracle-java10-installer

      Delete
    3. Not surprising that Oracle is making things difficult for everyone. Thank you so much for maintaining this PPA!

      Delete
  6. I'm using this PPA and I found a small bug. I'm not sure if this is upstream or not, but /usr/lib/jvm/java-10-oracle/lib/fontconfig.Ubuntu.properties has the wrong path for DejaVu fonts. It has the directory for these fonts as /usr/share/fonts/truetype/ttf-dejavu instead of /usr/share/fonts/truetype/dejavu. I'm running Kubuntu 18.04 and my fonts are in the latter directory.

    Nothing exactly breaks explicitly because of this, but it does cause fonts to be messed up, without any real indication as to why.

    ReplyDelete
    Replies
    1. Thanks! I will update the package with this fix in a few minutes.

      Delete
  7. Any suggestions for setting JAVA_HOME?

    ReplyDelete
    Replies
    1. Installing oracle-java10-set-default sets JAVA_HOME.

      Delete
  8. I am getting error on installing oracle java. Can any one fix it

    Downloading Oracle Java 10...
    --2018-08-29 20:15:35-- http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz
    Resolving false (false)... failed: Name or service not known.
    wget: unable to resolve host address ‘false’
    download failed
    Oracle JDK 10 is NOT installed.
    dpkg: error processing package oracle-java10-installer (--configure):
    installed oracle-java10-installer package post-installation script subprocess returned error exit status 1

    ReplyDelete
    Replies
    1. It looks like something doesn't allow downloading the Oracle Java archive on your system, be it some proxy, firewall, router, Internet service provider or something like that.

      I mentioned a workaround for such cases in the article: "Just like the original package, my Oracle Java 10 package supports installing Java by downloading the archive manually. This is useful in case you're behind a firewall or your ISP somehow blocks the Oracle JDK 10 download link. To do this, download the Oracle Java 10 tar.gz archive and place it in the /var/cache/oracle-jdk10-installer folder. Next, install the oracle-java10-installer package and it should pick up the downloaded tar.gz archive instead of downloading it by itself."

      Delete
  9. Great to find this! Do you think you can provide the same package also for ARMHF? I've just installed the official Ubuntu 18.04 server image for the Raspberry Pi 2 (from http://cdimage.ubuntu.com/releases/18.04.1/release/) and it works great, but while the official Raspbian image provides Oracle Java for ARMHF (see https://www.raspberrypi.org/blog/oracle-java-on-raspberry-pi/) the Ubuntu image doesn't.

    ReplyDelete
  10. Hi
    Have time to support JDK 11?

    ReplyDelete
  11. Thanks, please update to ppa to support oracle-java11-installer

    ReplyDelete
  12. sudo apt install oracle-java10-set-default

    That seems not to have changed the JAVA_HOME variables, for all purposes, I have java installed, but when required JAVA_HOME, it shows the error message that JAVA_HOME was failed to find.

    ReplyDelete
  13. Hey...there...
    I had the java oracle 8 and I installed the new one that you're talking about it which is oracle java 10...
    I'm working on javafx and when I upgraded my jdkhome in netBeans it didn't work because there is no javafx packages in the java-oracle10...

    any ideas??

    ReplyDelete
    Replies
    1. There is no javafx binary in the Linux Oracle JDK 10.

      Delete
  14. Thanks Logix, this information helped me a lot. I spend days trying to install Java 10 on my laptop running Linux Mint. I tried several ways that I found on Internet but none worked. Now, using your method, I was able to download and install Java 10. Now I need to learn how to compile java programs using the terminal, I need to do more research on Internet, I guess.

    ReplyDelete
  15. Today (2018-10-17) it is impossible to download JDK 10 from Oracle site - 404 every time.
    Are there any mirrors available for jdk-10.0.2_linux-x64_bin.tar.gz?

    ReplyDelete
    Replies
    1. New Java versions are out. For Java 10, it looks like Oracle no longer provides binaries for download (they might for those who pay for Java but the downloads are not available directly). This link doesn't allow downloading Oracle Java 10 and it just throws a 404 error when trying to download it.

      Delete
    2. OK. Oracle has stopped serving binaries to public.
      What is the point of this PPA as of September 2018 (JVM)?
      It should use another mirror for binaries or output a Warning message about Oracle EOL.

      Delete