STEP – 1 Go to https://www.oracle.com/in/java/technologies/javase/javase-jdk8-downloads.html
STEP – 2 DOWNLOAD Linux x86 Compressed Archive package
STEP – 3 Untar (Extract) the downloaded package by using the following command in your Terminal
STEP – 4PROCEED WITH THE FOLLOWING COMMAND:
After you put the correct path, It will ask for the sudo password, proceed accordingly.
STEP – 5 UPDATE THE ALTERNATIVES BY USING THE FOLLOWING COMMAND IN YOUR TERMINAL:
STEP – 6 NOW YOU WILL NEED TO update the JAVA_HOME in your ~/.bashrc, Kindly choose the correct path as per your directory, copy and paste the following:
export JAVA_HOME=/usr/lib/java/jdk version
set PATH=”$PATH:JAVA_HOME/bin”
STEP – 7 Run source .bashrc command
STEP – 8 FINALLY RUN THE sudo apt-get update COMMAND:
STEP – 9 CHECK THE JAVA VERSION, AND YOU ARE GOOD TO GO!!