Install Oracle Java JDK in Ubuntu 20.04 LTS

Java is the most popular programming language. To install Java on Ubuntu we have to follow the following steps:
Step 1 : Download Oracle Java JDK
First of all Download Java JDK on your system from official oracle website.
Download Oracle Java Jdk : https://www.oracle.com/java/technologies/javase-downloads.html
Step 2: Check Java version
Check if java is already installed on your system or not.
$ java -version
Step 3: Install Java using debian file
Use the following command to install the downloaded debian file.
$ sudo dpkg -i jdk-version.deb
Step 4 : Set up Environment variable
For setting up environment varible first of all navigate to this folder. /user/lib/jvm.
$ ls /user/lib/jvm
Now update java alternatives
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-16.0.1/bin/java 1
Then, update java compiler alternatives
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-16.0.1/bin/javac 1
Now if you check the version of Java and Java Compiler :
$ java --version
$ javac --version
For JAVA_HOME
Now for setting up JAVA_HOME type the following commands on terminal.
$ sudo update-alternatives --config java
$ source /etc/environment
$ echo $JAVA_HOME
Go through this video for complete instruction for Java JDK installation with JAVA_HOME