Since Java 8 is not installed by default on Kali Linux new versions. This guide will show you how to manually install JDK 8 without any errors. This is essential to run some of the apps, because they typically require Java 8 to work and will not run on Java 11. The JDK also allows you to develop in Java but if you don't care about that, you can install the JRE the same way.
Follow The Below Instructions To Accomplish it :
STEP 1) JDK8 can be downloaded from the Oracle website.
STEP 2) Go To jvm Directory. Use the command: cd /usr/lib/jvm
STEP 3) Unzip the JDK8 File. Use the command: sudo tar -xvzf ~/Downloads/jdk-8u321-linux-x64.tar.gz
STEP 4) Now Edit The Environment Variable. Use the command: sudo nano /etc/environment
STEP 5) Add The Following Variables :
:/usr/lib/jvm/jdk1.8.0_321/bin:/usr/lib/jvm/jdk1.8.0_321/db/bin:/usr/lib/jvm/jdk1.8.0_321/jre/bin
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_321"
J2REDIR="/usr/lib/jvm/jdk1.8.0_321/jre"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_321"
DERBY_HOME="/usr/lib/jvm/jdk1.8.0_321/db"
STEP 6) Update the JDK Files. Use the following commands:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_321/bin/java" 0
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_321/bin/javac" 0
sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_321/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_321/bin/javac
STEP 7) Now update the alternatives lists. Use the following commands:
sudo update-alternatives --list java
sudo update-alternatives --list javac
sudo update-alternatives --config java
Now select the option 2 and press Enter.
Now check the java version by simply just giving the command: java -version
If you have followed all the above given steps correctly than Java 8(openjdk-8-jdk) has been successfully installed into your system.
So, Thats all for Today! I hope you have successfully installed the java 8 on your system. And if yes, then please share this with your friends & loved ones who are facing problems to install openjdk-8-jdk in their systems. If you have faced any kinds of error during the installation process feel free to leave a comment down below. Have a wonderful day!