How to Install JDK in Windows 11

Learning how to install JDK in Windows 11 allows you to develop, compile, and run Java applications on your computer. The Java Development Kit (JDK) is a software package that provides essential tools for Java programming, including the Java compiler, Java Runtime Environment components, and other development utilities. Whether you are a student, beginner, or software developer, installing JDK is an important step towards creating Java programs.
-
Check Your Windows 11 System Requirements
Before installing JDK, make sure your laptop meets the basic requirements.
You need:
- A Windows 11 computer.
- A compatible 64-bit processor.
- Sufficient storage space.
- Administrator privileges.
- An internet connection to download the installer.
You should also check whether your computer uses a 64-bit operating system by opening Settings, selecting System, and clicking About.
-
Visit the Official Java Website
The first step is to download JDK from a trusted source.
Open your browser and visit the official Oracle Java website or the Eclipse Temurin website.
Look for the Java Development Kit download section and select a Windows version compatible with your laptop.
Choose a supported JDK release, such as JDK 21 or another version required by your programming project.
-
Download the JDK Installer
After selecting your preferred JDK version, choose the Windows installer.
For most Windows 11 laptops, select the x64 installer.
If you are downloading from Oracle, you can choose the Windows executable installer with the .exe extension.
Click Download and wait for the installation file to finish downloading.
-
Run the JDK Installer
Open your Downloads folder and locate the downloaded JDK installation file.
Double-click the installer to begin the setup process.
If Windows asks for permission to make changes to your device, click Yes.
The installation wizard will appear and guide you through the process.
Click Next to continue with the installation.
-
Choose the Installation Location
The installer will ask you where you want to install JDK.
You can use the default installation folder or select another location on your laptop.
For example, the default Oracle installation folder may look like:
C:\Program Files\Java\jdk-21
Click Next or Install, depending on the installer, and wait for the installation to complete.
-
Configure the JAVA_HOME Environment Variable
Configuring JAVA_HOME helps development tools locate your JDK installation.
Follow these instructions:
- Open the Windows Start menu.
- Search for Environment Variables.
- Select Edit the system environment variables.
- Click Environment Variables.
- Under System Variables, click New.
- Enter JAVA_HOME as the variable name.
- Enter your JDK installation folder as the variable value.
- Click OK to save the changes.
For example:
C:\Program Files\Java\jdk-21
Make sure the folder matches the JDK version and installation location on your laptop.
-
Add Java to the Windows PATH
Adding Java to PATH allows you to run Java commands from Command Prompt.
In the Environment Variables window:
- Locate Path under System Variables.
- Select it and click Edit.
- Click New.
- Enter %JAVA_HOME%\bin.
- Click OK to save all changes.
Close and reopen Command Prompt so Windows can recognise the updated environment variables.
-
Verify the JDK Installation
After completing the installation, confirm that JDK is working correctly.
Press Windows + R, type cmd, and press Enter.
In Command Prompt, enter:
java -version
Press Enter to display the installed Java version.
Next, enter:
javac -version
This command checks whether the Java compiler is available.
If both commands display version information, your JDK installation and PATH configuration are working correctly.
-
Write and Run Your First Java Program
You can now test your JDK installation by creating a simple Java program.
Open Notepad and enter:
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello World!”);
}
}
Save the file as HelloWorld.java.
Open Command Prompt, navigate to the folder where you saved the file, and run:
javac HelloWorld.java
Then enter:
java HelloWorld
Your computer should display Hello World! This confirms that Java can compile and run your program.
Also Read: How to Install Adobe Photoshop on a Laptop
