Post

Installing OpenJDK on Kali Linux: Complete Tutorial

Installing OpenJDK on Kali Linux: Complete Tutorial

Video Tutorial

What is OpenJDK?

OpenJDK (Open Java Development Kit) is a free and open-source implementation of the Java Platform, Standard Edition. It’s essential for running Java applications and development tools.

Prerequisites

Before you begin, ensure you have:

  • Kali Linux (latest version recommended)
  • Basic understanding of Linux commands

Installing OpenJDK

Step 1: Update Package List

First, let’s update the package list to ensure we have the latest information:

1
sudo apt update

Step 2: Install OpenJDK

Install the default JDK package:

1
sudo apt install default-jdk -y

Step 3: Verify Installation

Check if Java is installed correctly:

1
java -version

You should see output similar to:

1
2
3
openjdk version "17.0.x"
OpenJDK Runtime Environment ...
OpenJDK 64-Bit Server VM ...

Step 4: Set JAVA_HOME (Optional)

If you need to set JAVA_HOME environment variable:

  1. Find Java installation path:
    1
    
    update-alternatives --list java
    
  2. Add to your shell profile (e.g., ~/.bashrc):
    1
    2
    
    export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
    export PATH=$PATH:$JAVA_HOME/bin
    
  3. Apply changes:
    1
    
    source ~/.bashrc
    

Uninstalling OpenJDK

To remove OpenJDK:

1
2
sudo apt remove default-jdk -y
sudo apt autoremove -y

Additional Information

This post is licensed under CC BY 4.0 by the author.