Skip to content

Instantly share code, notes, and snippets.

@joakime
Created November 10, 2025 16:54
Show Gist options
  • Select an option

  • Save joakime/096f76003e8d3540dda7961198c19e7e to your computer and use it in GitHub Desktop.

Select an option

Save joakime/096f76003e8d3540dda7961198c19e7e to your computer and use it in GitHub Desktop.
Script to get the latest of a specific major version of a JVM from Adoptium, using api.adoptium.net
#/usr/bin/env bash
# See https://api.adoptium.net/q/swagger-ui/ for documentation about api.adoptium.net
# For valid list of values for the following, see documentation about API
# See: https://api.adoptium.net/v3/info/available_releases
JVM_FEATURE="$1"
if [ -z $JVM_FEATURE ] ; then
echo "ERROR : No JVM feature provided."
echo "Usage : ./getjvm.sh [jvm-feature]"
echo "Example: ./getjvm.sh 17"
echo ""
echo "Here's the list of the currently available jvms..."
curl https://api.adoptium.net/v3/info/available_releases
exit -1
fi
JVM_RELEASE_TYPE="ga"
JVM_OS="linux"
JVM_ARCH="x64"
JVM_TYPE="jdk"
JVM_IMPL="hotspot"
JVM_HEAP_SIZE="normal"
JVM_VENDOR="eclipse"
curl --location \
--remote-name \
--remote-header-name \
https://api.adoptium.net/v3/binary/latest/${JVM_FEATURE}/${JVM_RELEASE_TYPE}/${JVM_OS}/${JVM_ARCH}/${JVM_TYPE}/${JVM_IMPL}/${JVM_HEAP_SIZE}/${JVM_VENDOR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment