πŸ“ What You’ll Learn

  • What the JDK is and why you need it
  • How to download and install the JDK
  • Picking and setting up an IDE (like IntelliJ or VS Code)
  • Verifying your installation
  • Writing a basic "Hello, World!" program

πŸ”§ What is the JDK?

The Java Development Kit (JDK) is a software package that includes the Java compiler, Java Runtime Environment (JRE), and tools to develop Java programs.

You need it installed to:

  • Compile .java files into bytecode
  • Run Java applications locally

⬇️ Step 1: Download the JDK

  1. Go to the official Java website: πŸ‘‰ https://dev.java

  2. Choose your OS (Windows, macOS, Linux)

  3. Download the latest Long-Term Support (LTS) version – currently Java 21 LTS is recommended

πŸ’» Step 2: Install the JDK

On Windows:

  • Run the .exe installer
  • Accept defaults or choose install path (e.g., C:\Program Files\Java\jdk-21)
  • After install, set your JAVA_HOME environment variable
  • Add JAVA_HOME\bin to the system PATH

On macOS:

  • Install using the .pkg installer
  • Java is usually auto-configured by macOS
  • Verify via terminal: java -version

On Linux (Ubuntu/Debian):

sudo apt update
sudo apt install openjdk-21-jdk

βœ… Step 3: Verify Installation

Open your terminal or command prompt and type:

java -version

You should see something like:

openjdk version "21.0.2" 2024-01-16
OpenJDK Runtime Environment (build 21.0.2+13-58)
OpenJDK 64-Bit Server VM (build 21.0.2+13-58, mixed mode, sharing)

πŸ› οΈ Step 4: Choose an IDE

An IDE (Integrated Development Environment) makes writing Java easier with features like autocomplete and debugging.

Popular IDEs:

  • IntelliJ IDEA (Community Edition) – Best full-featured option
  • VS Code – Lightweight with Java extensions
  • Eclipse – Veteran option, a bit dated but functional

πŸ‘‰ For beginners, we recommend IntelliJ:

✏️ Step 5: Create Your First Java File

In your IDE or text editor:

  1. Create a new file called HelloWorld.java
  2. Add this code:
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
  1. Compile the file (if using terminal):
javac HelloWorld.java
  1. Run it:
java HelloWorld

πŸŽ‰ Output

Hello, World!

If you see that, you're ready to dive into Java programming!