April 2, 2023
There are lots of cybersecurity projects and tools are available on the internet. Some of them like
In our this article we are going to learn how to install OpenJDK 8 on our Kali Linux system.
Installing OpenJDK 8 on Kali Linux
In our this article we are going to install OpenJDK 8 on our favorite Kali Linux system. Before that we are going to check our system which version if Java is installed on our system by applying following command on our terminal:
java -version
We can see the output on the following screenshot:
In the above screenshot we can clearly see that we have only OpenJDK 11 on our system. Let’s start the OpenJDK 8 installation process start. First of all we need to go into Oracle Official website and
After sign up and login we need to move to the
For our x64 PC we are downloading the highlighted version |
We click on the jdk-8u321-linux-x64.tar.gz link to download. Then we got a popup window and we accept the terms and conditions of Oracle to download this. Shown in the following screenshot:
Now we need to click on the download button and let the download finish. Usually the downloads files stored on our Downloads directory. Now lets open our terminal and navigate to /usr/lib/jvm (If our system doesn’t have any of Java versions then we need to create this jvm directory under /usr/lib manually by using sudo mkdir -p /usr/lib/jvm command) by using following command:
cd /usr/lib/jvm
Now here we are going to extract our Java OpenJDK 8 compressed file by using following command:
sudo tar -xvzf ~/Downloads/jdk-8u321-linux-x64.tar.gz
We can see the output on the following screenshot:
After all files extracted we need to navigate to our newly de-compressed directory (jdk1.8.0_321) by using following command:
cd jdk1.8.0_321
Here we need to set the java path to do so we need to change the environmental variables. We need to edit the file by text editor like Nano, so we run the following command to edit the file:
sudo nano /etc/environment
We can see the output of the above command in the following screenshot:
In the above screenshot we can clearly see that there are some paths are already set. Two paths are divided by : symbol. Here we need to add some paths so we added a : sign after /usr/games path and add some paths that is /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
After adding these paths our files looks like following screenshot:
In the above screenshot we had highlighted the modified part of default file. Now we save and close this file by using CTRL+X then Y then Enter ⤶ key.
Now we will install OpenJDK 8 as an alternative, so that we can change our Java versions easily as per our requirement. We need to use following command:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_321/bin/java" 0
After that we will set Java compiler by using following command:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_321/bin/javac" 0
Now we can set Java OpenJDK 8 by using following command:
sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_321/bin/java
Also for the Java compiler we use following command:
sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_321/bin/javac
Output of these previous commands shown in the following screenshot:
Now we are ready to rock. Let choose our Java version by using following command from anywhere of our terminal:
sudo update-alternatives --config java
The output of the above command shown in the following screenshot:
In the above screenshot we can clearly see that our Java version 8 is on the number 2, and the Java version 11 is on number 0. So we just need to run the above command to switch between Java versions. Here we are going to use Java OpenJDK8, so here we need to type 2 and hint ENTER ⤶ button. As we can see in the following screenshot:
Now we are using Java 8, as we can see the output of java -version command in the following screenshot:
In the above screenshot we can see that now Java version 8 (In JDK 8 and JRE 8, the version strings are 1.8 and 1.8) is default on our system. Now we can use any tool using Java8 on our system easily. This is how we can install Java 8 on Linux (especially on Kali Linux) manually.
Love our articles? Make sure to follow us on Twitter and GitHub, we post article updates there. To join our KaliLinuxIn family, join our Telegram Group. We are trying to build a community for Linux and Cybersecurity. For anything we always happy to help everyone on the comment section. As we know our comment section is always open to everyone. We read each and every comment and we always reply.
This is the article generated by feed coming from KaliLinux.in and Infocerts is only displaying the content.