Install Java 21 on Windows 11

By mahantesh.nagathan
Install Java 21 on Windows 11

Java is a widely utilized programming language that runs across multiple platforms, including Windows, Linux, and macOS. Designed as an improvement over C++, Java simplifies development by eliminating complex features while providing a powerful compiler and interpreter. 

Steps to Install Java 21 on Windows 11

Installing Java 21 on Windows 11 is a simple process. Follow the steps below to install Java 21 on Windows 11 operating system. 

1.To install Java 21, visit Oracle’s official website and click Download Java for the latest version.
 

Download Java

 

2. Now, the Downloads page will appear. Navigate to the JDK 21 tab and click on the Windows link.
 

Navigate to the JDK 21 tab and click on the Windows link


3. Now, click on the Windows Installer as shown below.


Windows Installer

4. Locate the downloaded .exe file and double-click to run the installer. The Java 21 installation wizard will open—click Next to proceed.
 

Locate the downloaded .exe file and double-click to run the installer


5. Specify the installation path for Java directories and files in the Destination Folder section. It is recommended to keep the default path: C:\Program Files\Java\jdk-21. Click Next to proceed.

Specify the installation path for Java directories

 

6. The installation process will proceed and be completed within a few seconds.
 

installation process will proceed and be completed


7. Once the installation is complete, you will see a confirmation screen. Click Close to exit the installer.
 

Once the installation is complete, you will see a confirmation screen


Setting the JDK Path

1. First, locate the directory where Java JDK is installed. Copy the full bin path required to set up the environment variables. The default installation path is:  

C:\Program Files\Java\jdk-21\bin

Here is a screenshot of the bin directory where Java is installed.


directory where Java is installed


2. The easiest way to set the JDK path is to search for Environment Variables in the start menu. Click on the Edit the system environment variables.
 

Edit the system environment variables


3. A new dialog box will appear. Click on Environment Variables to proceed.
 

Click on Environment Variables to proceed

 

4. Navigate to the System Variables section and double-click on Path, as shown in the screenshot below.

 

Navigate to the System Variables section and double-click on Path

 

5. The steps are now presented as a list, as shown in the screenshot below.

  • Double-click on Path, and a new dialog box will open.
  • Click New and add the Java JDK path: C:\Program Files\Java\jdk-21\bin
  • Click OK to save the changes.

 

 steps are now presented as a list, as shown in the screenshot below

 

This completes the installation and the JDK path configuration. Next, we will verify the JDK installation.

Verify Java JDK Installation

1. Once you install Java 21 on Windows 11, verify the installation by running the following command in the Command Prompt:  

java --version

2. Type cmd in the Start Menu search bar and click Open to launch the Command Prompt.

 

click Open to launch the Command Prompt


3. Let's execute the above command in the command prompt to verify the Java installation.

 

command prompt to verify the Java installation

 

If Java is installed correctly, you will see Java 21 and its build details displayed.  

Java 21 is now successfully installed and ready for use!

Conclusion

Installing Java 21 on Windows 11 is simple. It includes downloading the installer, specifying the JDK path, and verifying the installation. By following the steps indicated in this guide, you can ensure a seamless installation and begin using Java for development right away. Whether you're developing applications, running Java-based tools, or exploring new capabilities in Java 21, this installation lays the groundwork for a smooth coding experience. 

Share this blog:

Profile picture for user mahantesh.nagathan
mahantesh.nagathan
As a passionate Technical Content Writer, Mahantesh creates insightful and engaging content on IT solutions and emerging technologies.