Skip to content

About

A complete, beginner-friendly guide to setting up Java (JDK), VS Code, and IntelliJ IDEA on Windows.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation

β˜• Java Setup Guide for Beginners (Windows)

A Complete, Beginner-Friendly Guide to Setting Up Java on Windows

Java Windows VS Code IntelliJ License: MIT

Stuck setting up Java on your PC? This guide gets you from zero to your first running Java program β€” step by step, with fixes for every common error.

Getting Started β€’ Common Errors β€’ IDE Comparison β€’ What's Next


πŸ“– Table of Contents


πŸ“Œ What's Required for Java Programming?

Before writing a single line of Java code, you need three things in place:

1️⃣ JDK (Java Development Kit)

The JDK is the core package required to develop and run Java applications. It bundles together:

Component Purpose
javac (Java Compiler) Converts your .java source code into bytecode
JRE (Java Runtime Environment) Provides the libraries needed to run Java programs
JVM (Java Virtual Machine) Executes the compiled bytecode on your machine
Standard Java Libraries Pre-built classes (collections, I/O, utilities, etc.)

⚠️ Without the JDK, Java programs cannot be compiled or executed β€” it's a non-negotiable first step.

2️⃣ IDE / Code Editor

An IDE (Integrated Development Environment) makes writing, running, and debugging code far easier than a plain text editor.

IDE Best For
IntelliJ IDEA Beginners and serious Java learners (Recommended)
Visual Studio Code Lightweight, flexible, multi-language workflows
Eclipse Legacy enterprise projects

πŸš€ Recommended Setup for Beginners

Option 1 β€” IntelliJ IDEA πŸ† (Best for Java Beginners)

  • βœ… Automatic project management
  • βœ… Smarter error detection
  • βœ… Intelligent code completion
  • βœ… One-click run/debug

Best for: students who want to learn Java seriously, with minimal configuration headaches.

Option 2 β€” VS Code ⚑

  • βœ… Lightweight and fast
  • βœ… Highly customizable
  • ⚠️ Requires manually installing Java extensions

Best for: students already comfortable in the VS Code ecosystem.


πŸ“₯ Step 1: Download and Install JDK

Download

Get the JDK directly from Oracle:

πŸ”— Oracle Java Downloads

πŸ’‘ You can also use the free, open-source Eclipse Temurin (Adoptium) build if you prefer not to create an Oracle account.

Which File Should I Download?

File Type Recommendation
x64 Installer (.exe) βœ… Best choice for most users
x64 MSI Installer (.msi) Use for corporate/enterprise silent installs
Compressed Archive (.zip) Advanced users who want a portable install

Choose a file that looks like:

jdk-<version>_windows-x64_bin.exe

Example:

jdk-25_windows-x64_bin.exe

πŸ“ Note: Oracle releases a new JDK version every 6 months, but only certain versions are LTS (Long-Term Support) β€” these get years of updates and are what most courses, universities, and production environments standardize on. As of mid-2026, JDK 21 and JDK 25 are the current LTS releases. Newer non-LTS versions (such as JDK 26) work fine too and are great for learning, but stick to an LTS version if you want maximum compatibility with tutorials, libraries, and course material.

Install

  1. Double-click the downloaded installer
  2. Click Next
  3. Click Install
  4. Click Finish

πŸ“‚ Step 2: Verify Installation

Open Command Prompt and run:

java -version

Expected output (version number will match what you installed):

java version "25.0.1" 2025-09-16 LTS

Check the compiler too:

javac -version

Expected output:

javac 25.0.1

βœ… If both commands return version info, your JDK is installed correctly β€” move on to Step 3 only if you see an error.


βš™οΈ Step 3: Configure Environment Variables

If java or javac aren't recognized, you need to set up your environment variables manually.

Create JAVA_HOME

Open the Start Menu and search for:

Edit the system environment variables

Click Environment Variables, then under System Variables, click New:

Field Value
Variable Name JAVA_HOME
Variable Value C:\Program Files\Java\jdk-25

⚠️ Replace the path above with your actual JDK installation folder. It usually lives under C:\Program Files\Java\. Open File Explorer and check the exact folder name before copying this.

Add Java to PATH

  1. In the same Environment Variables window, select Path under System Variables
  2. Click Edit β†’ New
  3. Add:
%JAVA_HOME%\bin
  1. Click OK on all open windows to save.

Verify

Open a brand-new Command Prompt window (environment changes don't apply to already-open windows):

echo %JAVA_HOME%

Expected:

C:\Program Files\Java\jdk-25

Check the binary path:

where java

Expected:

C:\Program Files\Java\jdk-25\bin\java.exe

πŸ’» Step 4: Install Visual Studio Code

Download VS Code from:

πŸ”— code.visualstudio.com

Run the installer with default settings.


πŸ”Œ Step 5: Install Java Extensions in VS Code

  1. Open VS Code
  2. Go to the Extensions panel (Ctrl+Shift+X)
  3. Search for:
Extension Pack for Java
  1. Install the official package published by Microsoft

This pack bundles:

  • πŸ”€ Language Support for Java
  • 🐞 Debugger for Java
  • πŸ“¦ Maven Support
  • βœ… Java Test Runner
  • 🧰 Project Manager for Java

🧠 Step 6: Install IntelliJ IDEA (Optional but Recommended)

Download from:

πŸ”— jetbrains.com/idea/download

Choose:

IntelliJ IDEA Community Edition  (Free & Open Source)

Install with default settings.


✍️ Your First Java Program

Create a new file named:

Hello.java

Write the following code:

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

▢️ Compile and Run from Terminal

Compile the source file into bytecode:

javac Hello.java

This generates a Hello.class file.

Run the compiled program:

java Hello

Output:

Java is working!

πŸ“ Important Rule

The public class name must exactly match the file name (case-sensitive).

βœ… Correct:

public class Hello { ... }

File name: Hello.java

❌ Incorrect:

public class Test { ... }

File name: Hello.java

This mismatch will throw a compilation error:

error: class Test is public, should be declared in a file named Test.java

πŸ”₯ Common Problems and Fixes

❌ Problem 1: 'java' is not recognized

'java' is not recognized as an internal or external command, operable program or batch file.

Fix:

  • βœ… Verify JDK is actually installed
  • βœ… Configure JAVA_HOME correctly (see Step 3)
  • βœ… Add %JAVA_HOME%\bin to your Path
  • βœ… Close and reopen Command Prompt (old windows won't see the new PATH)

❌ Problem 2: 'javac' is not recognized

Fix:

This means the JDK's bin folder isn't on your PATH. Add:

%JAVA_HOME%\bin

to your system Path variable, then open a fresh terminal.


❌ Problem 3: VS Code can't detect Java

Fix:

  • βœ… Install the Extension Pack for Java (see Step 5)
  • βœ… Restart VS Code completely
  • βœ… Confirm JAVA_HOME is set correctly β€” VS Code's Java extensions rely on it

❌ Problem 4: java.lang.UnsupportedClassVersionError

This happens when you compile with a newer JDK but try to run with an older JRE.

Fix:

  • βœ… Make sure only one JDK version is on your PATH
  • βœ… Run java -version and javac -version and confirm they match

🎯 Which IDE Should You Use?

Feature VS Code IntelliJ IDEA
Lightweight βœ… ❌
Easy Setup ⚠️ Manual extensions needed βœ… Works out of the box
Java Support Good Excellent
Beginner Friendly Good Best
Professional Java Development Good Excellent

🏁 Recommendation

If you are... Use...
A complete beginner IntelliJ IDEA
Coding in multiple languages VS Code
Working professionally with Java IntelliJ IDEA

πŸ“š Next Topics to Learn

Once your environment is ready, follow this learning path:

  1. Variables and Data Types
  2. Input using Scanner
  3. Operators
  4. Conditional Statements (if, else, switch)
  5. Loops (for, while, do-while)
  6. Arrays
  7. Methods
  8. Classes and Objects
  9. Inheritance
  10. Polymorphism
  11. Exception Handling
  12. Collections Framework (ArrayList, HashMap, etc.)

🀝 Contributing

Found an error, an outdated link, or want to add a setup guide for macOS or Linux? Contributions are welcome!

  1. Fork this repository
  2. Create a new branch (git checkout -b improvement/your-topic)
  3. Commit your changes
  4. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License β€” feel free to use, share, and adapt it for your own learning resources.


⭐ If this guide helped you set up Java, consider giving it a star!

Made with β˜• and patience for fellow beginners.

About

A complete, beginner-friendly guide to setting up Java (JDK), VS Code, and IntelliJ IDEA on Windows.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors