Install Java on Ubuntu

Tags:

Here are the steps to install Java on Ubuntu.

  1. Remove OpenJDK, if you have it installed:

$ sudo apt-get purge openjdk*

2.  install the software-properties-common package:

$ sudo apt-get install software-properties-common

3. Add the PPA:

$ sudo add-apt-repository ppa:webupd8team/java

4. Update the repo index:

$ sudo apt-get update

5. Install Java

5.1 Install Java 8:

$ sudo apt-get install oracle-java8-installer

5.2 install Java 7:

$ sudo apt-get install oracle-java7-installer

5.3  install Java 6:

$ sudo apt-get install oracle-java6-installer