The Ultimate Java Setup Guide (2025): Install JDK on Windows, Mac & Linux

This article is Chapter 3 of the Free Java Course. It was originally published on SRF Developer.

You cannot write a single line of Java code without the JDK (Java Development Kit).

Many beginners get stuck right here. They download “Java,” try to …


This content originally appeared on DEV Community and was authored by SRF DEVELOPER

This article is Chapter 3 of the Free Java Course. It was originally published on SRF Developer.

You cannot write a single line of Java code without the JDK (Java Development Kit).

Many beginners get stuck right here. They download "Java," try to run a command, and get the dreaded error:
'javac' is not recognized as an internal or external command.

In this guide, I will walk you through the correct way to set up your environment for Windows, Mac, and Linux, and how to fix the Environment Variable issues.

JDK vs JRE: What's the difference?

Before we install, you need to download the right thing.

  • JRE (Java Runtime Environment): Lets you run Java apps (like Minecraft).
  • JDK (Java Development Kit): Lets you write and compile Java apps.

As a developer, you always need the JDK.

Step 1: Download the JDK

For 2025, I recommend JDK 21 (LTS) as it is the current Long Term Support version used by most companies.

  1. Go to the Oracle Website.
  2. Select your Operating System (Windows/macOS/Linux).
  3. Windows Users: Download the x64 Installer (.exe).
  4. Mac Users: Download the Arm64 DMG Installer (for M1/M2/M3 chips) or x64 (for Intel).

Step 2: Installation

The installation is usually a "Next > Next > Finish" process.

  • Windows: Run the .exe and note down the installation path (usually C:\Program Files\Java\jdk-21).
  • Mac: Double-click the .dmg and follow the prompts.

Step 3: The Critical Step (Environment Variables) ⚠️

This is where 90% of beginners fail. If you don't do this, your terminal won't know where Java is.

For Windows Users:

  1. Search for "Edit the system environment variables" in the Start Menu.
  2. Click "Environment Variables".
  3. Under System Variables, click New.
    • Variable Name: JAVA_HOME
    • Variable Value: C:\Program Files\Java\jdk-21 (Or wherever you installed it).
  4. Find the Path variable, click Edit, then click New.
  5. Type: %JAVA_HOME%\bin
  6. Click OK on everything.

For Mac/Linux Users:

You need to update your shell configuration (.zshrc or .bashrc).

Open your terminal and run:


bash
echo 'export JAVA_HOME=$(/usr/libexec/java_home)' >> ~/.zshrc
source ~/.zshrc

Step 4: Verify Installation
Close any open terminals/command prompts and open a new one. Type:
java -version

If you see java version "21.0.x", congratulations! You are ready to code.

​Next Steps

​Now that your environment is ready, it's time to write your first "Hello World" program.

​Need visual help? I have created a guide for every single step (including how to verify the Path) on the full blog post.
​👉 [Click here to read the Full Visual Guide on SRF Developer](https://www.srfdeveloper.com/2025/11/chapter-3-how-to-install-java-jdk-windows-mac-linux.html)


This content originally appeared on DEV Community and was authored by SRF DEVELOPER


Print Share Comment Cite Upload Translate Updates
APA

SRF DEVELOPER | Sciencx (2025-11-30T06:50:34+00:00) The Ultimate Java Setup Guide (2025): Install JDK on Windows, Mac & Linux. Retrieved from https://www.scien.cx/2025/11/30/the-ultimate-java-setup-guide-2025-install-jdk-on-windows-mac-linux/

MLA
" » The Ultimate Java Setup Guide (2025): Install JDK on Windows, Mac & Linux." SRF DEVELOPER | Sciencx - Sunday November 30, 2025, https://www.scien.cx/2025/11/30/the-ultimate-java-setup-guide-2025-install-jdk-on-windows-mac-linux/
HARVARD
SRF DEVELOPER | Sciencx Sunday November 30, 2025 » The Ultimate Java Setup Guide (2025): Install JDK on Windows, Mac & Linux., viewed ,<https://www.scien.cx/2025/11/30/the-ultimate-java-setup-guide-2025-install-jdk-on-windows-mac-linux/>
VANCOUVER
SRF DEVELOPER | Sciencx - » The Ultimate Java Setup Guide (2025): Install JDK on Windows, Mac & Linux. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/11/30/the-ultimate-java-setup-guide-2025-install-jdk-on-windows-mac-linux/
CHICAGO
" » The Ultimate Java Setup Guide (2025): Install JDK on Windows, Mac & Linux." SRF DEVELOPER | Sciencx - Accessed . https://www.scien.cx/2025/11/30/the-ultimate-java-setup-guide-2025-install-jdk-on-windows-mac-linux/
IEEE
" » The Ultimate Java Setup Guide (2025): Install JDK on Windows, Mac & Linux." SRF DEVELOPER | Sciencx [Online]. Available: https://www.scien.cx/2025/11/30/the-ultimate-java-setup-guide-2025-install-jdk-on-windows-mac-linux/. [Accessed: ]
rf:citation
» The Ultimate Java Setup Guide (2025): Install JDK on Windows, Mac & Linux | SRF DEVELOPER | Sciencx | https://www.scien.cx/2025/11/30/the-ultimate-java-setup-guide-2025-install-jdk-on-windows-mac-linux/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.