Setting Up Java 21 Development Environment

Are you ready to start learning Java 21? Before writing your first line of code, you need to set up your development environment. Don’t worry—it’s not hard! This guide will help you step by step in setting up Java 21 development environment.

Setting Up Java 21 Development Environment

✅ Step 1: Install Java 21 (JDK)

The JDK (Java Development Kit) is what you need to run and build Java programs.

🔽 Download the JDK

Pick one of these trusted sources:

Choose the version for your operating system (Windows, Mac, Linux), then install it.

I am using a Windows system and work on the Open JDK

✅ Check if it’s working

After installing, open your terminal (Command Prompt on Windows or Terminal on Mac/Linux), and type:


✅ Step 2: Choose an IDE

An IDE (Integrated Development Environment) is an app that helps you write code easily. It gives you features like suggestions, highlighting, and debugging.

💡 Best IDEs for Java

  • IntelliJ IDEA – beginner-friendly, powerful
  • VS Code – lightweight and fast. Also has inbuilt Copilot plugins.
  • Eclipse – great for big projects

Install any one of them. I use Eclipse and some time VS Code.


✅ Step 3: Set Up a Build Tool (Maven or Gradle)

Java developers use build tools to manage projects, add libraries, and compile code.

You can choose Maven or Gradle—both are good.

🛠️ Maven (Beginner-Friendly)

In Maven, we use a file called pom.xml to manage the project.

Here’s how you tell Maven to use Java 21:

You can install Maven from https://maven.apache.org/ . Or if you are using IDE and executing your classes inside them, they already have built in Maven plugins.

⚙️ Gradle (Slightly Advanced)

In Gradle, the config goes into a build.gradle file:

Gradle is more flexible and modern but takes a bit more time to learn. So as a beginner, you should start with Maven.


✅ Step 4: Write and Run Your First Java Program

Let’s write a simple program to test your setup!

File: TestFirstJava.java

Compile it and run it


🧠 Quick Recap

ToolWhat It Does
JDK 21Runs and compiles Java programs
IDEHelps you write and debug code
MavenManages libraries and builds code
GradleSame as Maven, but more flexible

Hope this guide for setting up Java 21 development environment was helpful !!!