DEV Community

Cover image for How to Install Corretto 8 on Windows
Shoichi Okaniwa
Shoichi Okaniwa

Posted on • Originally published at qiita.com

How to Install Corretto 8 on Windows

Introduction

I might transition from OracleJDK to Amazon Corretto, so I documented the steps for installing Corretto 8 on Windows 10. This method likely works for Windows 7 as well.

For Mac installations, this article was helpful: [Java] Installing Amazon Corretto 8.

What is Corretto?

Corretto is a JDK implemented by Amazon, verified by the Java community and compatible with the Java SE standard. It can be used on Amazon Linux 2, Windows, and Mac, with more OS support on the way.

What is Corretto 8?

Amazon Corretto 8 is a JDK for Java 8, with free support expected until at least June 2023.

Downloading the Installer

The Corretto 8 installer is available here.

image.png

For my Windows 64bit environment, I downloaded amazon-corretto-8.202.08.2-windows-x64.msi. For Windows 32bit, download from Windows x86.

The JRE version lacks a compiler, so the JDK version is necessary for development (though JRE includes the JVM and API).

Running the Installer

Double-click the installer to start the wizard and follow the on-screen instructions.

Corretto01.PNG
Corretto02.PNG
Corretto03.PNG
Corretto04.PNG
Corretto05.PNG

At this point, the installation is complete. By default, it's installed at:

C:\Program Files\Amazon Corretto\jdk1.8.0_202
Enter fullscreen mode Exit fullscreen mode

Setting Environment Variables

For Command Prompt

First, check JAVA_HOME. It should be automatically added to your system environment variables by the installation. If JAVA_HOME existed before, its value gets overwritten.

Verify the setup with:

echo %JAVA_HOME%
Enter fullscreen mode Exit fullscreen mode

It should display C:\Program Files\Amazon Corretto\jdk1.8.0_202.

Add the following to the start of the Path system environment variable:

%JAVA_HOME%\bin

Skip this if you had previously added another JDK.

For Git Bash

If using Git Bash, manually set its environment variables. Open %USERPROFILE%\.bash_profile in a text editor (create it if absent).

Add these at the end and save:

# Java
export JAVA_HOME='/c/Program Files/Amazon Corretto/jdk1.8.0_202'
export PATH=$PATH:${JAVA_HOME}/bin
Enter fullscreen mode Exit fullscreen mode

Restart Git Bash and verify by running:

echo $JAVA_HOME
Enter fullscreen mode Exit fullscreen mode

It should display /c/Program Files/Amazon Corretto/jdk1.8.0_202.

Checking the Java Version

Check your Java version in Command Prompt or Git Bash with:

java -version
Enter fullscreen mode Exit fullscreen mode

If this displays correctly, your installation was successful. Congratulations!

openjdk version "1.8.0_202"
OpenJDK Runtime Environment Corretto-8.202.08.2 (build 1.8.0_202-b08)
OpenJDK 64-Bit Server VM Corretto-8.202.08.2 (build 25.202-b08, mixed mode)
Enter fullscreen mode Exit fullscreen mode

Switching to Another JDK

To switch, change the JAVA_HOME system environment variable to the path of another JDK.

For example, if OracleJDK is installed at C:\Program Files\Java\jdk1.8.0_172, set JAVA_HOME to this path to enable OracleJDK over Corretto.

Conclusion

Installation was straightforward, and tests on existing Java projects ran without issues.

Top comments (0)