Ubuntu – How to install OpenJDK 8 on 14.04 LTS


Java 8 is now available according to http://openjdk.java.net/projects/jdk8/, but http://openjdk.java.net/install/ does not yet mention how to install OpenJDK 8 (not Oracle Java) on Ubuntu 14.04 Long Term Support. (For 14.10 and later just run apt-get install openjdk-8-jdk)

How and when can this be done?

(2017-08-08: The very short answer is: OpenJDK 8 as of 2017-08-08 is not officially available from the official repositories as an APT package for Ubuntu 14.04. See full summary in this answer)

Note: For now we will use Oracle Java – the optimal solution for me is, however, OpenJDK from the Ubuntu repositories, until Oracle Java is available directly and effortless from the Ubuntu repositories.

Best Answer

  • You can do this for;

    Final Update


    sudo apt-get install openjdk-8-jdk


    sudo apt-get install openjdk-8-jre

    Old Update

    I found two repository but I do not recommend

    • OpenJDK builds (all archs)

    • OpenJDK 8 backport for trusty


    Original Message

    If you really want to use OpenJDK, you have to compile from source. There is not still any PPA for OpenJDK.

    It has been requested at https://bugs.launchpad.net/ubuntu/+bug/1297065

    I recommend you to use Webup8 Oracle Java8 Installer

    Note: WebUpd8 team's PPA has been discontinued with effective from April 16, 2019. Thus this PPA doesn't have any Java files. More information can be found on PPA's page on Launchpad. Hence the below method no longer works and exists because of historical reasons.

    sudo add-apt-repository ppa:webupd8team/java -y
    sudo apt-get update
    sudo apt-get install oracle-java8-installer

    To automatically set up the Java 8 environment variables

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

    Check it

    java -version

    So you have to wait to use OpenJDK8