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.
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-dockerRun 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-appBoth steps complete successfully.
Edited by 程永顺
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
