How to install Oracle Java in Ubuntu via terminal?

Hello all, Today I am gonna share, how to install oracle java in Ubuntu.

Note: We can install Java in Ubuntu using the below command:

apt-get install open-jdk*

In addition,If it require to install official oracle jdk in your machine.Follow and execute the below commands:

Step 1 :

Adding installer script in PPA repository:

dd-apt-repository ppa:webupd8team/java

Step 2 :

Update the repository using as like below:

apt get update

Step 3:

Install oracle jdk using below command:

apt install oracle-java8-installer

While  the file is installing , A pop-up screen will come to accept the terms and conditions of oracle.Click Okay to continue.

Step 4:

To set installed Java 8 jdk as default,enter the below command:

sudo apt install oracle-java8-set-default

Step 5:

Verify the installation by entering the below command:

java -version

It shows something like the installed java run time version and its details.

Thank you for reading the post,Comments and questions are welcome.

Follow me to get more and more.