Why Amazon Corretto Is the Free, Multi‑Platform JDK You Need – Install on Mac & Docker

Amazon Corretto is a free, long‑term‑support OpenJDK distribution that runs on Linux, Windows, macOS and Docker, offering production‑ready performance and security updates, with step‑by‑step installation guides for macOS and Docker environments.

21CTO
21CTO
21CTO
Why Amazon Corretto Is the Free, Multi‑Platform JDK You Need – Install on Mac & Docker

Amazon AWS has released a free, long‑term‑support (LTS) distribution of OpenJDK called Corretto 8, with additional support for Corretto 11.

Corretto is a production‑ready, multi‑platform JDK that receives performance enhancements and security fixes, and Amazon guarantees free security updates for Corretto 8 until June 2023 and for Corretto 11 until August 2024.

It runs on Amazon Linux 2, Windows, macOS and Docker, and is used internally at Amazon for high‑performance, large‑scale services.

Key advantages:

Amazon long‑term support

Production‑ready

Multi‑platform: Linux, Windows, macOS, Docker

Completely free

Source code is available on GitHub at https://github.com/corretto and documentation at https://docs.aws.amazon.com.

Installing Corretto 8 on macOS

Download the installer from the official site.

Run the .pkg file; the JDK is installed under /Library/Java/JavaVirtualMachines.

Verify the installation with /usr/libexec/java_home -verbose.

Set JAVA_HOME to

/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home

.

Running Corretto 8 in Docker

Build an image:

Docker build -t amazon-corretto-jdk-8 github.com/corretto/corretto-8-docker

Run the container: Docker run -it amazon-corretto-jdk-8 To create a HelloWorld app using Corretto as the base image, use the following Dockerfile:

FROM amazon-corretto-8
RUN echo $'\
public class Hello { \
    public static void main(String[] args) { \
        System.out.println("Welcome to Amazon Corretto 8!"); \
    } \
}' > Hello.java
RUN javac Hello.java
CMD ["java", "Hello"]

Build and run the image:

Docker build -t hello-app .
Docker run hello-app

Both steps complete successfully.

Edited by 程永顺
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

javaInstallationOpenJDKAmazon CorrettoFree JDK
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.