Java Setup 2026: JDK 25, IntelliJ/VS Code, Your First Program

Every Java journey starts before a single line of code: you need the Java Development Kit on your machine, configured so your terminal and your editor can both find it. This post gets you from zero to a running program in about 30 minutes — and, just as importantly, shows you how to diagnose the three setup failures that bite nearly every beginner.

You will need: any reasonably modern computer (Windows, macOS, or Linux), about 500 MB of free disk space, and permission to install software. No prior Java knowledge is assumed.

Before you download anything: the one decision that matters

Java releases follow a predictable rhythm: a new version every six months, and every two years one of them is crowned LTS — Long-Term Support, meaning it gets security patches for years instead of months. Java 25, released September 2025, is the current LTS. The previous LTS, Java 21, is still everywhere in production, and that is fine — but for learning, install the newest LTS. You get the modern language features this track teaches, and you won't hit the "this feature needs a newer Java" wall in lesson three.

Next: which JDK 25 do you download? Java is an open specification, so several vendors ship their own builds of the exact same platform. Two reputable choices:

  • Eclipse Temurin (from the Adoptium project) — free, no account, no license paperwork, and the default recommendation of this track. Download page: adoptium.net/temurin/releases.
  • Oracle JDK — also free for most use under Oracle's no-fee terms, but archived older versions sit behind a login, and the licensing terms around production updates change over time. Fine to use; just read the terms if you ever deploy commercially.

Decision rule: if you don't have a reason to pick otherwise, install Temurin 25. If your employer or a course mandates Oracle's build, that works too — everything in this track behaves identically on both.

Step 1 — Install JDK 25

Grab the installer for your operating system from your chosen vendor's download page. Pick the JDK (not "JRE" — we'll explain the difference later), 64-bit, version 25.

Windows

Run the .msi (Temurin) or .exe (Oracle) installer. Accept the defaults, but on the Temurin installer make sure the "Set JAVA_HOME variable" and "Add to PATH" options are checked — they save you the manual work in Step 2. If you unchecked them (or used the Oracle installer, which doesn't offer them), follow the manual PATH instructions in Step 2.

macOS

Run the .pkg installer. macOS installs JDKs under /Library/Java/JavaVirtualMachines/, and you can list every Java on your Mac at any time with:

/usr/libexec/java_home -V

You should see an entry for 25.x.x in the output. (Apple-silicon Macs need the aarch64 / ARM64 build; Intel Macs need x64. The download pages select this automatically, but double-check — it's the most common wrong-download on Mac.)

Linux (Debian/Ubuntu)

The cleanest route is Adoptium's package repository:

sudo apt install -y wget apt-transport-https gpg
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update
sudo apt install temurin-25-jdk -y

On other distros, download the .tar.gz from Temurin, extract it to /usr/local/ or /opt/, and continue to Step 2.

Step 2 — Tell your system where Java lives: JAVA_HOME and PATH

Installing is only half the job. Your terminal finds programs through an environment variable called PATH — a list of folders it searches, in order, whenever you type a command. And many Java tools (Maven, Gradle, IDEs, app servers) look for a variable called JAVA_HOME that points at your JDK's root folder.

Decision rule: PATH must include the JDK's bin folder (that's where java and javac live). JAVA_HOME must point at the JDK folder itself — not at bin. Getting that second part wrong is trap #2 below, so note it now.

Windows

Open a terminal and run (adjust the version number in the path to match what you installed):

setx JAVA_HOME "C:\Program Files\Eclipse Adoptium\jdk-25.0.4.4-hotspot"
setx PATH "%PATH%;%JAVA_HOME%\bin"

setx writes the variables permanently, but it does not affect the terminal window you ran it in — close it and open a new one before verifying. Alternatively, set both in System Properties → Environment Variables with the GUI.

macOS / Linux

Add these lines to your shell's startup file — ~/.zshrc on modern macOS (default shell is zsh), ~/.bashrc on most Linux systems — then open a new terminal:

# macOS: let the system find JDK 25 for you
export JAVA_HOME=$(/usr/libexec/java_home -v 25)
export PATH="$JAVA_HOME/bin:$PATH"
# Linux (adjust the path to your actual install location)
export JAVA_HOME=/usr/lib/jvm/temurin-25-jdk-amd64
export PATH="$JAVA_HOME/bin:$PATH"

Run echo $JAVA_HOME — it should print the JDK folder, with no /bin at the end.

Step 3 — Verify the install

In a new terminal window, run:

java -version
javac -version

You should see something like this (your exact patch numbers will differ — that's normal and fine):

openjdk version "25.0.4" 2026-07-21 LTS
OpenJDK Runtime Environment Temurin-25.0.4+7 (build 25.0.4+7-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.4+7 (build 25.0.4+7-LTS, mixed mode, sharing)

Two things to check in that output:

  1. The first line says 25 — not 8, 11, 17, or 21. If it says anything else, you have an older Java earlier on your PATH (trap #1 below).
  2. javac -version also works and also says 25. java runs programs; javac compiles them. If java works but javac doesn't, you installed a JRE-style package instead of the full JDK — reinstall the JDK.

Pick your editor: IntelliJ IDEA Community or VS Code?

You can write Java in any text editor, but a proper IDE catches your mistakes as you type, completes your code, and runs programs with one click. Two free options dominate:

IntelliJ IDEA CommunityVS Code + Extension Pack for Java
CostFree and open source (the paid "Ultimate" edition adds frameworks you'll meet later)Free
Java smartsThe gold standard: best refactoring, navigation, and error detection for JavaVery good, powered by the same language server tech — slightly behind on deep refactoring
FootprintHeavy — wants 8 GB RAM comfortablyLight — happy on modest machines
Best forLearning Java seriously, large codebasesPolyglot developers, low-spec machines, people already living in VS Code

Decision rule: if you're learning Java as your main language and your machine can handle it, take IntelliJ IDEA Community — its inspections will teach you good habits. If you're already a VS Code person or your machine is light on RAM, install VS Code plus Microsoft's Extension Pack for Java and you'll be fully productive. Either way, point the IDE at your JDK 25: in IntelliJ it's Project Structure → SDK; in VS Code the extension usually detects it automatically.

Your first program

Create a file named HelloWorld.java — the filename must match the class name exactly, including capitalization — and type this:

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

Now compile and run it from the terminal, in the folder where you saved the file:

javac HelloWorld.java
java HelloWorld

Expected output:

Hello, Java 25!

What just happened, in three moves:

HelloWorld.java source you write javac HelloWorld.class bytecode java JVM runs it Hello, Java 25! 1. Write 2. Compile 3. Run
  1. javac HelloWorld.java compiles your source into HelloWorld.class — bytecode, the JVM's native language. No output on success means success; errors print here, not later.
  2. java HelloWorld runs it on the JVM. Note: no .class extension on the command — a classic beginner typo.

The modern shortcut (Java 25 style)

Since Java 25 finalized compact source files, a throwaway program can skip the ceremony:

void main() {
    System.out.println("Hello, Java 25!");
}

Save it as HelloWorld.java and run it directly — no javac step:

java HelloWorld.java

Decision rule: use the compact form for scratch experiments and scripts. Use the classic public class form for anything you'll keep, grow, or share — it's what every IDE project, build tool, and employer expects, and it's the form this track teaches from post 2 onward.

jshell: Java's scratchpad

The JDK ships with jshell, an interactive playground where you type Java and see results instantly — no files, no compile step. Perfect for testing an idea from a lesson before putting it in a program:

$ jshell
|  Welcome to JShell -- Version 25.0.4
|  For an introduction type: /help intro

jshell> int price = 1200;
price ==> 1200

jshell> double discounted = price * 0.9;
discounted ==> 1080.0

jshell> System.out.println("Payable: " + discounted);
Payable: 1080.0

jshell> /exit
|  Goodbye

Decision rule: reach for jshell when you're asking a question ("what does this expression evaluate to?"). Write a real file when you're building something you'll run twice.

JDK vs JRE in 2026: the short version

Old tutorials talk about downloading a separate JRE (Java Runtime Environment) just to run Java apps. Since Java 11, Oracle no longer ships standalone JRE downloads — the JDK (Java Development Kit) contains the full runtime plus the compiler and tools like jshell. For a developer, the JDK is the only download you need.

One line for the future: when you eventually ship an app, jlink (bundled in the JDK) can carve out a trimmed runtime containing only the modules your app uses — that's the modern answer to "but I don't want to ship a whole JDK."

When it breaks: the three classic traps

Trap 1 — An old Java is first on your PATH

Symptom: java -version reports 8, 11, 17, or 21 even though you just installed 25. Many machines already have a Java (bundled with some other software), and the terminal uses the first match on PATH.

Diagnose it:

# Windows: shows every java.exe, in PATH order
where java

# macOS / Linux: same idea
which -a java

Fix: move %JAVA_HOME%\bin (Windows) or $JAVA_HOME/bin (macOS/Linux) to the front of PATH, or uninstall the stale JDK.

Trap 2 — JAVA_HOME points at the wrong place

Symptom: tools complain they "cannot find Java" while java -version works fine in your terminal. Usual cause: JAVA_HOME was set to the bin folder (.../jdk-25/bin) instead of the JDK root (.../jdk-25). Check with echo %JAVA_HOME% (Windows) or echo $JAVA_HOME (macOS/Linux) — the value must not end in bin. Fix the variable, open a new terminal, re-check.

Trap 3 — "javac is not recognized"

Symptom: java -version works, but javac gives "not recognized as an internal or external command" (Windows) or "command not found". This means your PATH reaches a runtime-only install, not the JDK — or the JDK's bin was never added to PATH at all. Revisit Step 2, and confirm you downloaded the JDK package, not a JRE-only one.

What's next

You now have a working JDK 25, a verified terminal setup, an IDE waiting, and a compiled program under your belt. From here, the track stops talking about tooling and starts talking about Java itself: post 2 introduces variables, types, and how Java thinks about data — the foundation everything else builds on.

Field check before you move on: close your terminal, open a fresh one, and run java -version, javac -version, and echo $JAVA_HOME (or echo %JAVA_HOME%). If all three answer correctly in a brand-new window, your setup is solid. If anything fails, the fix is in the traps section above — not in reinstalling.

Continue: Java Learning Roadmap 2026

Comments

Popular posts from this blog

JSP Servlet Interview Questions For Freshers Series 1

Java Banking Finance Services and Insurance (BFSI) domain interview questions

Java program to check even or odd number