The objective of this guide is to show how to install the Java Development Kit (JDK) on Kali Linux. This is needed by Java developers and programmers in order to compile and run Java applications. It’s also required for security tools that are built in Java.
In this tutorial you will learn:
- How to install Java JDK in Kali Linux
|Category||Requirements, Conventions or Software Version Used|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Install Java JDK on Kali
Open a command line terminal and follow the steps below to install Java. We’ll test the installation afterwards by checking the Java version and compiling a test program.
- Use the apt package manager to update your system’s repositories and install the default JDK package.
$ sudo apt update $ sudo apt install default-jdk
If you want to install a specific version of the JDK, use the following command to search for the exact package you want. This will show all the JDK packages available for installation.
$ sudo apt-cache search openjdk
- Once the process is finished, you can verify the Java installation with the following command.
$ java --version
- For further verification that you can compile and run Java programs, try compiling a Java Hello World program.
- To switch between Java versions, execute the following two commands while selecting the Java version you require.
$ sudo update-alternatives --config java $ sudo update-alternatives --config javac
In this guide, we saw how to install Java JDK on Kali Linux. We also saw how to test the installation with a Java command and Hello World program, as well as the process for switching between installed versions of Java.