0
Explore
0

Setting Up the Java Development Environment (IDE) – A Beginner-Friendly Guide

Updated on July 27, 2025

Before you start writing your first Java program, it’s essential to set up the right environment on your computer. This includes installing the Java Development Kit (JDK), choosing an Integrated Development Environment (IDE), and configuring everything properly so you can easily write, compile, and run Java programs.

In this tutorial, we’ll guide you step-by-step through setting up the Java environment just like a classroom lesson. This setup is crucial whether you are a beginner or an intermediate learner getting started with Java programming.

What Do You Need to Write Java Programs?

To start writing Java programs, you need:

  1. Java Development Kit (JDK) – It contains everything you need to compile and run Java programs.
  2. Integrated Development Environment (IDE) – A tool that helps you write code more easily (like IntelliJ IDEA, Eclipse, or VS Code).
  3. Java Runtime Environment (JRE) – It’s part of the JDK and is required to run Java programs.

🛠️ Step 1: Install Java Development Kit (JDK)

🔹 What is JDK?

JDK stands for Java Development Kit. It includes tools like:

  • javac: The Java compiler.
  • java: The launcher to run Java programs.
  • Libraries and development tools.

🔹 Downloading JDK

  1. Go to the official Oracle JDK download page.
  2. Select the latest Java SE (Standard Edition).
  3. Choose the correct version based on your OS:
    • Windows
    • macOS
    • Linux
  4. Click Download, then install it like any other software.

💡 Tip: Always download the LTS (Long-Term Support) version if you’re just getting started.

🔹 Verify Installation

After installing:

1). Open Command Prompt (Windows) or Terminal (macOS/Linux).

2). Type:

java -version
javac -version

3). You should see the installed Java version.

If it shows an error, make sure Java is added to your system’s Environment Variables or PATH (explained below).

Interesting Post: Can You See java -version in CMD Without Setting Environment Variable?

🔧 Step 2: Set Environment Variables (Windows Users)

Setting environment variables lets your system recognize Java commands from any folder.

➤ Steps to Set PATH:

1. Search for Environment Variables in Windows search bar.

2. Click on Edit the system environment variables.

3. Click Environment Variables.

4. Under System variables, find Path, click Edit, and add:

C:\Program Files\Java\jdk-xx\bin

Replace jdk-xx with your actual folder name.

5. Click OK on all windows.

Now try running javac -version again to verify.

💡 Step 3: Choose and Install an IDE

🤔 What is an IDE?

An IDE (Integrated Development Environment) is a smart code editor that helps you:

  • Write clean, structured code.
  • Auto-complete Java syntax.
  • Debug and compile programs.
  • Manage multiple files and projects.
IDEBest ForWebsite
IntelliJ IDEA (Community Edition)Beginners & Professionalshttps://www.jetbrains.com/idea/
EclipseOpen-source lovershttps://www.eclipse.org/downloads/
NetBeansEasy GUI builder supporthttps://netbeans.apache.org/
VS Code + Java ExtensionsLightweight optionhttps://code.visualstudio.com/

Steps:

  1. Visit IntelliJ IDEA Download.
  2. Choose Community Edition (Free).
  3. Install like normal software.
  4. On first launch:
    • Choose Java project type.
    • Create a new project.
    • Set Project SDK (It will detect the installed JDK. If not, set manually.)

💡 IntelliJ IDEA has powerful code suggestions, debugging tools, and supports Maven/Gradle, which are helpful for real-world Java projects.

🖊️ Step 4: Write Your First Java Program

Let’s test everything with a simple “Hello World” Java program.

📄 Code:

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

Steps:

  1. Create a new project in your IDE.
  2. Add a new Java file: HelloWorld.java.
  3. Paste the above code.
  4. Click Run ▶️ or use:
    • IntelliJ: Right-click → Run HelloWorld.main()
    • Eclipse: Right-click → Run As → Java Application

If it prints Hello, World!, your environment is ready! 🎉

🧪 Extra Tips

💬 Using Command Line Instead of IDE

If you want to try compiling and running Java via command line:

1. Save your code in a file named HelloWorld.java.

2. Open terminal/command prompt.

3. Navigate to the file’s folder.

4. Run:

javac HelloWorld.java
java HelloWorld

You’ll see:

Hello, World!

🔍 IDE Shortcuts to Know (IntelliJ Example):

TaskShortcut (Windows)
RunShift + F10
Auto-completeCtrl + Space
Format codeCtrl + Alt + L
Open terminalAlt + F12

🎯 Practice Task

Task: Set up the Java environment, create a new project, and write a Java program that prints your name and favorite subject.

🏁 Final Words

Setting up your Java development environment is the first major step toward becoming a Java programmer. Whether you choose IntelliJ, Eclipse, or VS Code, the most important thing is to get comfortable with writing and running Java code.

Take your time to set things up properly – once the environment is ready, the real fun of programming begins! 🚀