How to Install Java 11 on Windows: Step by Step

In this tutorial, we will see a detailed step by step guide on how to setup the Java JDK 11 on Windows using the Amazon Corretto JDK.

How to Install Java 11 on Windows: Step by Step

Windows

The Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It is a collection of programming tools, including a Java compiler, a Java Virtual Machine (JVM), a debugger, and other tools and utilities needed to write, test, and debug Java programs.

The JDK is platform-independent and includes tools and libraries for developing, testing, and deploying Java applications across a variety of platforms, including Windows, macOS, and Linux. It also includes documentation and examples to help developers learn how to use the Java programming language and its associated APIs.

What is Amazon Corretto?

Amazon Corretto is a no-cost, multi-platform, production-ready distribution of the Open Java Development Kit (OpenJDK). It includes the Java SE standard libraries and components, such as the Java Virtual Machine (JVM), the Java class libraries, and the Java Development Kit (JDK) tools.

It is mainly built using the OpenJDK source code, and it is tested and certified to be compatible with the Java SE standard. It includes performance enhancements, security fixes, and bug fixes that are contributed to the OpenJDK community by Amazon and other contributors.

Requirements

  1. Windows 10 and above
  2. A working network connection
  3. Administrative permissions

Step 1 - Verify Java is Not Installed

The first step is to verify that you do not have an existing Java installation. Multiple Java JDKs can result in conflicting versions and compilation.

To check if Java is installed, open the command prompt and run the command:

java --version

The command above should return an error indicating that the specified command is not recognized. An example output is as shown below:

java: The term 'java' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

However, the command returns the Java version, then you have the Java JDK already installed on your machine.

To learn how to install Java JDK on Ubuntu, check here:

How to install Amazon Corretto JDK on Ubuntu
In this quick guide, we discuss how to install and setup the latest version of the Amazon Corretto JDK on Ubuntu.

Step 2 - Download the Amazon Corretto JDK

The second step is to download the Amazon Corretto JDK from the official downloads page. You can navigate to the link provided below:

Downloads for Amazon Corretto 11 - Amazon Corretto
List of downloads for Amazon Corretto 11.

On the Downloads Page, locate the installer for your Windows Version and start the download.

We recommend downloading the MSI installer version. If you are looking for a portable version, you can use the provided zip file instead.

Step 3 - Install Java on Windows

Once the download is complete, we can proceed and install Java on your Windows machine.

You can follow the steps as provided below:

Step 1 - Run the Provided Installer

Open the location where you saved the download installer file and open the installer file.

Step 2 - Configure the Installer

On the Welcome section, Click Next to proceed to the next step.

In the next section, choose the features you wish to install on your system and the destination location. For simplicity and maximum compatibility, we advise using the default values and ensure all components are installed.

Once satisfied, Click Next to proceed to the next step and begin the installation. The next step may require admin permissions to configure the installer on your machine.

Click Finish to finalize the setup process of the JDK on Windows.

Step 4 - Verify Java Installation

By default, the Amazon Corretto JDK automatically configures the path to the Java executable. To verify, open the command prompt and run the command:

java --version

In this case, the command should return the installed JDK version and vendor information as shown in the example below:

openjdk 11.0.18 2023-01-17 LTS
OpenJDK Runtime Environment Corretto-11.0.18.10.1 (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.18.10.1 (build 11.0.18+10-LTS, mixed mode)

Step 5 - Configure the JAVA_HOME Variable

JAVA_HOME is an environment variable that points to the location where Java Development Kit (JDK) or Java Runtime Environment (JRE) is installed on a computer.

When a Java application or tool is run, it looks for JAVA_HOME to determine the location of the JDK or JRE. Setting the JAVA_HOME environment variable ensures that the correct version of Java is used by the application or tool.

On Windows, we can configure the JAVA_HOME environment variable on Windows using the steps below:

Open the Start menu and search for "Environment Variables" and select "Edit the system environment variables".

In the System Properties window, click on the "Environment Variables" button.

In the Environment Variables window, under System Variables, click on the "New" button.

In the New System Variable window, enter JAVA_HOME in the "Variable name" field.

In the "Variable value" field, enter the path to the directory where Amazon Corretto 11 is installed. For example, if you installed Amazon Corretto 11 in the default location, the path should be C:\Program Files\Amazon Corretto\jdk11.0.18_10.

Click "OK" to save the new environment variable.

In the System Properties window, click "OK" to close it.

Restart any applications or tools that require Java, such as command prompt or IDE, to ensure they use the updated JAVA_HOME environment variable.

Step 6 - Write a Test Java Program

Once you have installed Java, it is good to test that the Java compiler is working. You can test it by building the classic hello world program as provided in the instructions below:

How to Code Hello World in Java
In this tutorial, we will learn how we to write the classic Hello World program using the Java programming language.

Conclusion

In this post, we covered how you can install the Java JDK 11 on Windows 10+ using the Amazon Corretto JDK. We hope this tutorial helped you. Leave us a comment down below to let us know what you think.

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.