Skip to main content

Java

Java is installed from the Amazon Coretto Ubuntu package repository. This repository provides the latest versions of Amazon Coretto. Version 17 of Amazon Coretto is pre-installed. Additional versions can easily be added.

To install a specific version of Amazon Coretto, use the following command:

# replace $VERSION with the version of Amazon Coretto you want to install
apt-get -qq install -y java-$VERSION-amazon-corretto-jdk

# Optional: point java and javac at the new version
update-alternatives --set java /usr/lib/jvm/java-$VERSION-amazon-corretto/bin/java
update-alternatives --set javac /usr/lib/jvm/java-$VERSION-amazon-corretto/bin/javac

You will also find the latest versions if maven, gradle and ant pre-installed on this image.