Installing Open JDK 1.8 on Ubuntu 14.04 LTS

OpenJDK Java 8 has been made into official Ubuntu repositories for 14.10 Utopic and higher. For Ubuntu 14.04, Ubuntu 12.04, and Linux Mint 17 users here’s how to install it from PPA.

  • sudo add-apt-repository ppa:openjdk-r/ppa
  • sudo apt-get update
  • sudo apt-get install openjdk-8-jdk

    You may have more than one version (like Open JDK 1.7 installed previously), so run this command below to set the default Java

  • sudo update-alternatives --config java

    And set default Java Compiler by running:

    sudo update-alternatives --config javac

Finally, check the java and javac version by running the commands below:

  • java -version  ,  javac -version