How to Install Java on Windows

Gaurav Shah
4 min readFeb 25, 2024

--

Introduction

The Java Development Kit (JDK) is a set of software tools for developing Java applications. The toolkit includes a compiler for converting Java code into bytecode, a collection of class libraries, documentation for integrating Java APIs, and the Java Runtime Environment (JDE) for executing Java code. The JDK provides developers with the resources they need to create Java applications and applets in one neat package.

Cover image

Download and Install Java

Download Java Development Kit (JDK)

To download the Java Development Kit installation file
1. Open a web browser and go to the Oracle Java Downloads page.
2. Select the latest JDK version. In this example, the latest available version is JDK 21.
3. Navigate to the Windows tab.
4. Click the x64 Installer download link.

Java Download

Wait for the download to complete.

Install Java Development Kit

To install Java Development Kit on your Windows system:
1. Double-click the downloaded Java file to start the installation.
2. Once the installation wizard welcome screen appears, select Next to proceed.

Java Installation Start Wizard
Java Installation Start Wizard

3. Choose the destination folder for the Java installation files, or stick to the default path and click Next.

Java Installation Path Selection wizard
Java Installation Path Selection wizard

4. The installation process is complete when the Successfully Installed message appears. Click Close to exit the wizard.

Java Installation Successful wizard
Java Installation Successful wizard

The JDK 21 is successfully installed on your Windows system. To enable program compiling from any directory, you must set up Java environment variables.

Set Environment Variables

To configure Java environment variables in Windows, follow the following steps

1. Add JAVA_HOME System Variable

Some applications require the JAVA_HOME variable to point to the JDK installation directory. Follow the steps below to create the variable:
1. Open the Start menu and search for environment variables.
2. Select Edit the system environment variables.

Edit environment Variables
Edit Environment Variables

3. Select Advanced in the System Properties window.
4. Click Environment Variables.

5. Click New under the System variables category to create a new variable.

6. Name the variable JAVA_HOME.
7. Enter the path to your Java JDK directory in the variable value field.
8. Click OK.

2. Add Java to Path Variables

Setting up Java System Variable ensures that Java is accessible from the command line in any directory.
1. In the Environment Variables wizard, Select the Path variable in the System variables category and click Edit.

2. Click New.
3. Enter the path as %JAVA_HOME%\bin.
4. Click OK to save the changes and exit the variable editing window.

Confirm the changes by clicking OK in the Environment Variables and System properties windows.

Test Java Installation

Verify that Java is installed by entering the java -version command in the command prompt. If installed correctly, the command outputs the Java version.

Installing Maven on Windows: A Beginner’s Guide
How to Install Maven on Windows

For more Java and Spring-Boot-related blogs, check out my profile:
https://medium.com/@gauravshah97

Reach me out at:
https://www.linkedin.com/in/gauravshah97/

--

--