☕ Java JDK 22 Installation & Setup Guide on Windows — A Step-by-Step Tutorial

☕ Java JDK 22 Installation & Setup Guide on Windows — A Step-by-Step Tutorial

Whether you're a Java developer, student, or just getting started with backend development, setting up your environment correctly is crucial. With Java 22 now available, here's a complete guide to installing the JDK and running your first program — no IDE required.


🚀 Why This Setup Matters

Installing Java isn't enough — your system needs to know where to find it. Here's why environment setup is essential:

  • System-wide Access – Run java, javac, and other tools from any terminal.
  • 🔄 Tool Compatibility – IDEs and build tools rely on JAVA_HOME.
  • 📦 Multiple Versions – Easily switch between different Java versions.
  • Convenience – No need to navigate into Program Files\Java every time.


🛠️ Step-by-Step: Install & Configure Java JDK 22 on Windows

1. Download Java 22

📥 Visit the official Oracle site: Oracle Java SE Downloads

Download the Java SE Development Kit 22 for Windows x64.


2. Install the JDK

  • Run the downloaded installer.
  • Default install location:

C:\Program Files\Java\jdk-22        

3. Set Environment Variables

Open:

This PC → Properties → Advanced System Settings → Environment Variables

✅ Add JAVA_HOME:

  • Variable name: JAVA_HOME
  • Value:

C:\Program Files\Java\jdk-22        

➕ Update the Path variable:

  • Edit the system Path
  • Add a new entry:

%JAVA_HOME%\bin        

(⚠️ Don’t delete existing entries.)


4. ✅ Verify Your Setup

Open a new Command Prompt and run:

java -version
javac -version
echo %JAVA_HOME%        

You should see:

  • Java version 22
  • Compiler version 22
  • The path to your JDK installation


👨💻 Run Java Without an IDE

This is perfect for learning, scripting, or minimal setups.

1. Create a Project Folder

C:\JavaProjects\HelloWorld        

2. Create Your Java Program

Open Notepad, paste the following:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, Java 22!");
    }
}        

Save it as:

HelloWorld.java        

3. Compile and Run from Command Prompt

cd C:\JavaProjects\HelloWorld
javac HelloWorld.java
java HelloWorld        

📌 You should see:

Hello, Java 22!        

💡 You Don’t Need an IDE (But It Helps)

IDEs like IntelliJ IDEA, Eclipse, or VS Code provide:

  • Autocomplete
  • Debugging
  • Version control tools

But for learning or scripting, the command line + text editor is all you need.


📊 Quick Reference Table

| Step                 | Purpose                                |
| -------------------- | -------------------------------------- |
| Install JDK          | To compile and run Java programs       |
| Set JAVA\_HOME       | Let tools locate your JDK installation |
| Update Path          | Use `java` and `javac` globally        |
| Create `.java`       | Write Java code using any text editor  |
| Compile with `javac` | Convert code to JVM bytecode           |
| Run with `java`      | Execute your program                   |
        

✅ Final Thoughts

Setting up Java manually not only gives you a better understanding of how the JDK works, but also prepares you for real-world scenarios where managing multiple Java versions or troubleshooting build tools is essential.


👍 Was this guide helpful? 💬 Let me know in the comments how you’re using Java 22 — or if you're just getting started!

#Java #JDK22 #SoftwareEngineering #Coding #IntelliJ #CommandLine #Programming #JavaDevelopment #BackendDevelopment #HowTo

To view or add a comment, sign in

More articles by Sereen Saud

Others also viewed

Explore content categories