-
Downlods java
-
sudo mkdir /usr/lib/jvm
-
cd /usr/lib/jvm
-
cp jre-8u351-linux-i586.tar.gz /usr/lib/jvm
-
sudo tar -xvzf jre-8u351-linux-i586.tar.gz
-
sudo gedit /etc/environment
-
Past the line in /etc/environment
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games COMMAND_NOT_FOUND_INSTALL_PROMPT=1 POWERSHELL_UPDATECHECK=Off POWERSHELL_TELEMETRY_OPTOUT=1 DOTNET_CLI_TELEMETRY_OPTOUT=1 /usr/lib/jvm/jre1.8.0_351/bin /usr/lib/jvm/jre1.8.0_351/db/bin /usr/lib/jvm/jre1.8.0_351/jre/bin J2SDKDIR="/usr/lib/jvm/jre1.8.0_351" J2REDIR="/usr/lib/jvm/jre1.8.0_351/jre" JAVA_HOME="/usr/lib/jvm/jre1.8.0_351" DERBY_HOME="/usr/lib/jvm/jre1.8.0_351/db" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jre1.8.0_351/bin:/usr/lib/jvm/jre1.8.0_351/db/bin:/usr/lib/jvm/jre1.8.0_351/jre/bin" J2SDKDIR="/usr/lib/jvm/jre1.8.0_351" J2REDIR="/usr/lib/jvm/jre1.8.0_351/jre" JAVA_HOME="/usr/lib/jvm/jre1.8.0_351" DERBY_HOME="/usr/lib/jvm/jre1.8.0_351/db"
-
Save and close the file.
-
Enter Following commands in your Terminal
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.8.0_351/bin/java" 0 sudo update-alternatives --install "/usr/bin/javac" "javaws" "/usr/lib/jvm/jre1.8.0_351/bin/javaws" 0 sudo update-alternatives --set java /usr/lib/jvm/jre1.8.0_351/bin/java sudo update-alternatives --set javaws /usr/lib/jvm/jre1.8.0_351/bin/javaws
-
Verify the setup
update-alternatives --list java update-alternatives --list javac
-
Check the Java Version
java -version