Hello everyone, and welcome to my blog! In this blog, we’ll learn how to install the latest Java version, JDK 21, on Windows 11. Follow along as we take you through the installation process step by step.
Step 1: Search for Oracle Java
Begin by opening your preferred web browser. In this demonstration, we’re using Chrome, but you can use any browser of your choice. Type “Oracle Java” into the search bar and press Enter. Click on the official website that appears in the search results.
Step 2: Download Java 21
Navigate to the official website and click on the “Download Java” button. Look for Java 21 (JDK 21) in the download section. Choose the Windows version and download the executable file (exe) that is approximately 160 MB in size.
Step 3: Installation Process
Once the download is complete, open the downloaded exe file to start the installation process. Click on Next, keeping the default settings. The installation directory path will be displayed; take note of it.
Step 4: Set Environment Variables
After installation, set the environment variables. Open the Start menu, type “environment variables,” and select “Edit the system environment variables.” In the System Properties window under Advanced section, click on “Environment Variables,” find the “Path” under System variables and double-click on it, and click on new to add the JDK 21 path.
Step 5: Verify Installation
Open the command prompt by typing “cmd” in the Start menu. To verify the installation, type “java –version” and press Enter. If successful, you’ll see confirmation that Java 21 has been installed.
Step 6: Create and Run Your First Java Program
Create a new Java file in any directory. Open the file with Notepad or Notepad++, and write a simple Java program. Save the file with a “.java” extension. Compile the program using “javac yourFileName.java” and press enter then automatically “yourFileName.class” extension file will get created and run it with “java yourFileName” in the command prompt.
Conclusion:
Congratulations! You have successfully installed Java JDK 21 on Windows 11 and run your first Java program. Now you’re ready to explore the world of Java programming. Thank you for following along with this blog.