The JDK is the set of tools needed to compile, execute, and debug Java programs. Let’s install it and prepare the terminal to find its commands.
It might seem trivial (just clicking “Next, Next”), but in the Java ecosystem, there’s a small initial trap: there are many distributions. Unlike other languages where there is a single official installer, in Java you have options from Oracle, Amazon, Microsoft, RedHat, Azul…
In this article, we will install an Open Source, free, and standard distribution, and most importantly: we will configure the environment variables so your computer knows where Java is.
Which JDK Distribution to Install
Java is open source (OpenJDK). This allows many companies to take the code, package it, and offer their own installer.
- Oracle JDK: Oracle’s distribution, with license and support conditions that should be reviewed for each version and use case.
- Amazon Corretto: Amazon’s version.
- Azul Zulu: Very good, used in certain niches.
- Eclipse Temurin (Adoptium): The one we recommend.
For this course, we will use Eclipse Temurin from the Adoptium project. It is a free distribution of OpenJDK, maintained by the community and available for major platforms.
Download and Install the JDK
We will install the latest recommended LTS (Long Term Support) version, which is Java 25.
- Go to the official Adoptium website.
- Choose Java 25 (LTS) and your system architecture. Most current Windows computers will be x64, but computers with an ARM processor need AArch64.
- Download the
.msiinstaller.
When you run the installer, you will see a screen with options and some small hard drives in red or gray. Stop right there!
By default, some options may be unchecked. To save manual work later, expand and check the option “Set or override JAVA_HOME variable”. Also verify that the installer adds Java to the PATH.
This will make the installer configure the environment variables for us. If you miss it, don’t worry; we explain how to do it manually below.
Click “Install” and wait for it to finish.
Understanding PATH and JAVA_HOME
If you checked the previous options, the configuration should be ready. However, it’s helpful to understand what the installer just did so you can fix it if some tool can’t find Java.
When you open a console (CMD or PowerShell) and type javac, the operating system needs to know where that javac.exe program is. The system doesn’t search the entire hard drive (it would take forever). It only searches in the folders listed in a special list called the PATH.
If we don’t add Java to the PATH, we would have to compile like this:
"C:\Program Files\Eclipse Adoptium\jdk-25.0.0\bin\javac.exe" MyProgram.javaBy adding that folder to the PATH, we can simply write:
javac MyProgram.javaThe JAVA_HOME Variable
In addition to the PATH, there is a convention in the Java world: the JAVA_HOME variable.
Many external tools (like Maven, Gradle, Tomcat, or your IDE) look for this variable to know where the JDK is installed. If it doesn’t exist, they can fail.
JAVA_HOME should point to the root folder of the installation (e.g., C:\Program Files\Eclipse Adoptium\jdk-25...), without going into the bin folder.
Verify the Installation
Let’s check that everything works. This is mandatory.
- Open a new terminal (CMD or PowerShell). If you had one open before, close it and open a new one to reload the variables.
- Type the following commands:
java --versionYou should see output starting with openjdk 25 indicating it’s an LTS version.
Now let’s test the compiler:
javac --versionIf both commands return the version, congratulations! You now have the execution and development environment ready.