Development

How to Install Java on Windows using Amazon Corretto JDK

Captain Salem 5 min read

How to Install Java 11 on Windows: Step by Step

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.

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.

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:

https://www.geekbits.io/how-to-install-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:

https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html

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

image-20230408154345915
image-20230408154345915

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.

image-20230408154808390
image-20230408154808390

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.

image-20230408154936125
image-20230408154936125

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.

image-20230408155116772
image-20230408155116772

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:

  1. Open the Start menu and search for “Environment Variables” and select “Edit the system environment variables”.
  2. In the System Properties window, click on the “Environment Variables” button.
  3. In the Environment Variables window, under System Variables, click on the “New” button.
  4. In the New System Variable window, enter JAVA_HOME in the “Variable name” field.
  5. 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.
  6. Click “OK” to save the new environment variable.
  7. In the System Properties window, click “OK” to close it.
  8. Restart any applications or tools that require Java, such as command prompt or IDE, to ensure they use the updated JAVA_HOME environment variable.
image-20230408155918245
image-20230408155918245
image-20230408155806641
image-20230408155806641
image-20230408155734738
image-20230408155734738
image-20230408155652921
image-20230408155652921

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:

https://www.geekbits.io/how-to-code-hello-world-in-java/

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.

Share
Comments
More from Cloudenv

Cloudenv

Developer Tips, Tricks and Tutorials.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Cloudenv.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.