A Comprehensive Guide on Configuring the Java JDK on Windows

Suresh Madhusanka Rodrigo
3 min readAug 31, 2024

--

Verify that the JDK is not installed.

To verify the installed version of your Java compiler (JDK), open the Command Prompt in Windows and enter the following command:

javac -version

If the JDK is not installed, you will see an output similar to the one shown below. You can then follow the installation steps provided.

Alternatively, you can check if the Java Runtime Environment (JRE) is installed by using the following command:

java -version

If the JRE is not installed, you will see an output similar to the one shown below. You can then follow the installation steps provided.

JDK is for development, while the JRE is for running Java applications. If you’re developing Java programs, you’ll need the JDK. If you’re only running Java programs, the JRE is sufficient.

Downloading and Installing the JDK

To download the Java JDK, Visit the Official Java SE Downloads Page:
Java Downloads | Oracle

Under the “Java SE Development Kit” section, find the version you need.

Click on the download link that corresponds to the Windows version (e.g., jdk-XX_windows-x64_bin.exe).

Once the download is complete, locate the downloaded file and double-click it to start the installation process.
Follow the on-screen instructions to complete the installation.

Set JAVA_HOME Variable:

After installation, you need to set up the JAVA_HOME environment variable (The JAVA_HOME variable should be set according to the location where you have installed Java. For example, if Java is installed in C:\Program Files\Java\jdk-22, you should set the variable as per below).

Navigate to the ‘Edit Environment Variables’ window.

Click ‘New’ under the System Variables section.

Set the ‘Variable name’ to JAVA_HOME.
Set the ‘Variable value’ to the JDK installation directory (e.g., C:\Program Files\Java\jdk-22).

Update the PATH Variable:

In the System Variables section, find and select the ‘Path’ variable, then click ‘Edit’.

Click ‘New’ and add %JAVA_HOME%\bin to the list. This ensures your system can find the Java executables.

Verify that the JDK is installed.

Open Command Prompt and type java -version and javac -version to check if the installation was successful (Installing the JDK, it includes the JRE) as well. This means you don’t need to install the JRE separately).

You should see the installed JDK version numbers.

--

--

Suresh Madhusanka Rodrigo

Senior Software Quality Assurance Analyst at LSEG | MSc in Computer Science | CIMA Passed Finalist | ISTQB CTFL | ISTQB CTAL-TAE | Travelling | Cricket | Sports