This post explains how to install Java 8 in your Ubuntu OS. If you are running Windows OS, it is straight forward to download the EXE file and install it. Even the same way you can do it for Ubuntu by loading the package. However, there is very simple and easy solution in Ubuntu is to download from the repository which is advantage since you would get the notification of any update to the Java version.
At present Java 8 is not by default included in the repository. We have to use the Personal Package Archive (PPA), is a collection of software not included in Ubuntu by default. Here I provide you the details on how to install Java 8 quickly. You just follow the below steps to install it.
- Open Terminal and ENter “sudo add-apt-repository ppa:webupd8team/java”
- Enter the command “sudo apt-get update”
- Enter the command “sudo apt-get install oracle-java8-installer”. If you have already installed the Java 6 or Java 7 and want to replace the Java 8 as the default, then use this command “sudo apt-get install oracle-java8-set-default”. This will remove the old versions and install the Java 8 and set the environment variables for Java 8.
- After install if you want to switch to Java 8, enter this command “sudo update-java-alternatives -s java-8-oracle”. In the same way if you want to switch back to Java 7 use this command “sudo update-java-alternatives -s java-7-oracle”.
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer
Once you run the above steps, installation process will start. It would take several minutes to complete the installation.
I hope this post would be more useful for those who are working on the Ubuntu environment.