Steps to Install Java on Ubuntu OS
In this article, we will guide you how to install Java on Ubuntu. The default installation of java on Ubuntu is not directly provided by Oracle.
Steps to Install Java:-
We can install it using the apt-get command.
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
Install Oracle JDK 8:-
To install Oracle JDK 8
sudo apt-get install oracle-java8-installer
Managing different Version of Java on the Same system:-
When we have multiple Java installations on our system, the Java version to use as default can be chosen. To do this we have to execute the following command:-
sudo update-alternatives --config java
To choose the default java version, we have to provide the selection number. as if I have to use Java 6, then I have to provide selection number 1.
To check the default version of Java, we can check it using the below-mentioned command:-