### Run the Updater tool Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/STRUCTURE.md After building, navigate to the updater directory and run the jar with dependencies to start the updater. ```bash cd ./adoptium-api-v3-updater ``` ```bash java -jar ./target/adoptium-api-v3-updater-3.0.0-SNAPSHOT-jar-with-dependencies.jar ``` -------------------------------- ### Run the Front-end Quarkus application Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/STRUCTURE.md Start the front-end in development mode on port 8080. Requires the Updater to have completed a full cycle first. ```bash cd ./adoptium-api-v3-frontend ``` ```bash ../../mvnw quarkus:dev -Padoptium ``` -------------------------------- ### Stable URL for latest Java 17 JRE installer for Windows x64 Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc URL to download the latest Java 17 JRE installer for Windows on 64-bit Intel CPUs. Uses the /v3/installer/latest endpoint with project=jdk parameter. ```html https://api.adoptium.net/v3/installer/latest/17/ga/windows/x64/jre/hotspot/normal/eclipse?project=jdk ``` -------------------------------- ### Available releases JSON response Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc Example JSON response from the /v3/info/available_releases endpoint. Lists LTS and regular releases, most recent feature release/version, most recent LTS, and tip version. ```json { "available_lts_releases": [ 8, 11, 17 ], "available_releases": [ 8, 11, 16, 17, 18, 19 ], "most_recent_feature_release": 19, "most_recent_feature_version": 20, "most_recent_lts": 17, "tip_version": 21 } ``` -------------------------------- ### Upgrade Maven version using Maven Wrapper Source: https://github.com/adoptium/api.adoptium.net/blob/main/CONTRIBUTING.md Use this command to upgrade the Maven version used by the project. Replace 'xxx.yyy.zzz' with the desired Maven version. The example shows upgrading to version 3.9.6. ```bash mvn -N wrapper:wrapper -Dmaven=xxx.yyy.zzz ``` ```bash mvn -N wrapper:wrapper -Dmaven=3.9.6 ``` -------------------------------- ### Export GitHub App Environment Variables Source: https://github.com/adoptium/api.adoptium.net/blob/main/CONTRIBUTING.md Set these environment variables at runtime to use GitHub App authentication with the updater. Replace the placeholder values with your actual app ID, installation ID, and private key contents. ```bash export GITHUB_APP_ID="1234" export GITHUB_APP_INSTALLATION_ID="1234" export GITHUB_APP_PRIVATE_KEY=$'-----BEGIN PRIVATE KEY----- -----END PRIVATE KEY-----' ``` -------------------------------- ### Full Build and Test with Maven (Adoptium) Source: https://github.com/adoptium/api.adoptium.net/blob/main/CONTRIBUTING.md Run this command to perform a full build and test for the Adoptium profile. ```bash ./mvnw clean install -Padoptium ``` -------------------------------- ### Build for AdoptOpenJDK Ecosystem Source: https://github.com/adoptium/api.adoptium.net/blob/main/CONTRIBUTING.md Use this command to produce an AdoptOpenJDK ecosystem build. ```bash ./mvnw clean install -Padoptopenjdk ``` -------------------------------- ### Check AdoptOpenJDK Source: https://github.com/adoptium/api.adoptium.net/blob/main/adoptium-api-v3-staging-checker/README.md Runs the checker for AdoptOpenJDK. ```bash java -cp ...jar net.adoptium.api.v3.checker.StagingLiveChecker adoptopenjdk ``` -------------------------------- ### Staging Live Checker Usage Source: https://github.com/adoptium/api.adoptium.net/blob/main/adoptium-api-v3-staging-checker/README.md Shows the command-line usage, including vendor selection and options for overriding URLs, versions, and help. ```text Usage: StagingLiveChecker [vendor] [options] Vendor (first positional argument): adoptium Use Adoptium staging/live URLs (default) adoptopenjdk Use AdoptOpenJDK staging/live URLs Options: --staging-url Override the staging API base URL --live-url Override the live API base URL --versions Comma-separated list of Java versions to check (default: 8,11,17,21,22,23,24,25) --help, -h Show this help message and exit ``` -------------------------------- ### Run Staging Live Checker Source: https://github.com/adoptium/api.adoptium.net/blob/main/adoptium-api-v3-staging-checker/README.md Runs the checker using the built jar with dependencies. The main class is net.adoptium.api.v3.checker.StagingLiveChecker. ```bash java -cp adoptium-api-v3-staging-checker/target/adoptium-api-v3-staging-checker-*-jar-with-dependencies.jar \ net.adoptium.api.v3.checker.StagingLiveChecker ``` -------------------------------- ### Use Custom Staging and Live URLs Source: https://github.com/adoptium/api.adoptium.net/blob/main/adoptium-api-v3-staging-checker/README.md Runs the checker with custom staging and live API base URLs. ```bash java -cp ...jar net.adoptium.api.v3.checker.StagingLiveChecker \ --staging-url https://my-staging.example.com \ --live-url https://my-live.example.com ``` -------------------------------- ### Build API Components with Docker Compose Source: https://github.com/adoptium/api.adoptium.net/blob/main/CONTRIBUTING.md Build the API components using Docker and docker-compose. ```bash docker-compose build ``` -------------------------------- ### Generate artifacts with Maven wrapper Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/STRUCTURE.md Run this command to build the project artifacts before running the updater. ```bash mvnw clean install ``` -------------------------------- ### Build Staging Live Checker with Maven Source: https://github.com/adoptium/api.adoptium.net/blob/main/adoptium-api-v3-staging-checker/README.md Builds the staging checker from the project root, requiring the 'staging-checker' and 'adoptium' profiles. Skips tests. ```bash ./mvnw package -Pstaging-checker,adoptium -pl adoptium-api-v3-staging-checker -am -DskipTests ``` -------------------------------- ### Run Docker Compose with GitHub Token Source: https://github.com/adoptium/api.adoptium.net/blob/main/CONTRIBUTING.md Set your GitHub access token as an environment variable and run docker-compose up to spin up the full stack. ```bash export GITHUB_TOKEN=your-personal-github-token docker-compose up ``` -------------------------------- ### Shell script to download Temurin binary with verification Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc Bash script that downloads a Temurin binary and checks it was received successfully. Uses set -eu for strict error handling. The script is incomplete in the source. ```bash #!/bin/bash set -eu ``` -------------------------------- ### Enable Cloudflare Stats Collection Source: https://github.com/adoptium/api.adoptium.net/blob/main/CONTRIBUTING.md Set these environment variables to enable Cloudflare stats collection, then run docker-compose up. ```bash export CLOUDFLARE_ZONE_TAG=your-zone-tag export CLOUDFLARE_API_TOKEN=your-cloudflare-api-token docker-compose up ``` -------------------------------- ### Check Adoptium with Default Versions Source: https://github.com/adoptium/api.adoptium.net/blob/main/adoptium-api-v3-staging-checker/README.md Runs the checker for Adoptium with default versions. ```bash java -cp ...jar net.adoptium.api.v3.checker.StagingLiveChecker ``` -------------------------------- ### Download JDK 17 with curl and verify checksum Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc Downloads the latest JDK 17 for Linux x64, follows redirects, and validates the SHA256 checksum. The API_URL can be adapted for other versions and platforms. ```bash API_URL="https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64/jdk/hotspot/normal/eclipse" # Fetch the archive FETCH_URL=$(curl -s -w %{redirect_url} "${API_URL}") FILENAME=$(curl -OLs -w %{filename_effective} "${FETCH_URL}") # Validate the checksum curl -Ls "${FETCH_URL}.sha256.txt" | sha256sum -c --status echo "Downloaded successfully as ${FILENAME}" ``` -------------------------------- ### Query download count for latest Java 8 Linux x64 with jq Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc Fetches the latest Java 8 GA build for Linux x64 and extracts its download count. Uses the version range [8,9) and filters for jdk, ga, and linux x64. ```bash $ curl -s 'https://api.adoptium.net/v3/assets/version/%5B8%2C9%29?architecture=x64&os=linux&image_type=jdk&project=jdk&release_type=ga&sort_method=DATE&sort_order=DESC' | jq '.[0].binaries[0].download_count' 236264 ``` -------------------------------- ### Generate Maven Site Reporting Source: https://github.com/adoptium/api.adoptium.net/blob/main/CONTRIBUTING.md Run this command after a successful build to view all Maven reporting about the project. ```bash ./mvnw site -Padoptium ``` -------------------------------- ### Check Specific Versions Source: https://github.com/adoptium/api.adoptium.net/blob/main/adoptium-api-v3-staging-checker/README.md Runs the checker for Adoptium with a custom list of versions. ```bash java -cp ...jar net.adoptium.api.v3.checker.StagingLiveChecker adoptium --versions 11,17,21 ``` -------------------------------- ### PowerShell script to download latest Adoptium builds Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc Defines a share folder and release list, then iterates over releases, platforms, and types to fetch asset info from the Adoptium API. It downloads missing files, removes old ones, and verifies checksums. ```powershell # Define Folders For Downloads $ShareFolder = "" # Define Releases To Download $Releases = @('8', '11', '17', '21') $Releases | ForEach-Object { $Release = $_ $Platforms = @('linux', 'windows') $Platforms | ForEach-Object { $Platform = $_ $Types = @('jdk', 'jre') $Types | ForEach-Object { $Type = $_ $ReleaseInfo = Invoke-WebRequest -Uri "https://api.adoptium.net/v3/assets/latest/$Release/hotspot?architecture=x64&image_type=$Type&os=$Platform&vendor=eclipse" -UseBasicParsing | ConvertFrom-Json $CurrentDate = Get-Date -UFormat "%Y-%m-%dT%H:%M:%SZ" $TimeDifference = New-TimeSpan -Start $ReleaseInfo.binary.updated_at -End $CurrentDate $Found = Get-ChildItem -Filter $ReleaseInfo.binary.package.name -Path $ShareFolder if ($null -eq $Found) { Remove-Item "$ShareFolder\OpenJDK$ReleaseU-$Type*" Write-Host "Downloading file $($ReleaseInfo.binary.package.name) to $ShareFolder" Invoke-WebRequest -Uri "https://api.adoptium.net/v3/binary/latest/$Release/ga/$Platform/x64/$Type/hotspot/normal/eclipse" -UseBasicParsing -OutFile "$ShareFolder\$($ReleaseInfo.binary.package.name)" Write-Host "Comparing checksums" $DownloadHash = Get-FileHash "$ShareFolder\$($ReleaseInfo.binary.package.name)" $AdoptiumHash = $ReleaseInfo.binary.package.checksum if ($AdoptiumHash -ne $DownloadHash.hash) { Write-Host "An integrity issue has been found with $($ReleaseInfo.binary.package.name) on $ShareFolder" } } else { Write-Host "The file $($ReleaseInfo.binary.package.name) appears to have already been downloaded." } } } } ``` -------------------------------- ### Query latest Java 19 Windows x32 build date with jq Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc Fetches all Java 19 builds for Windows 32-bit, sorted by date descending, and extracts the most recent build's updated_at timestamp. The version range [19,20) is URL-encoded as %5B19%2C20%29. ```bash $ curl -s 'https://api.adoptium.net/v3/assets/version/%5B19%2C20%29?os=windows&architecture=x32&sort_method=DATE&sort_order=DESC' | jq '.[0].binaries[0].updated_at' "2022-12-13T09:39:04Z" ``` -------------------------------- ### Query available releases with curl and jq Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc Fetches the available releases JSON and extracts the most recent LTS version using jq. The output shows the value 17. ```bash $ curl -s https://api.adoptium.net/v3/info/available_releases | jq '.most_recent_lts' 17 ``` -------------------------------- ### Convert RSA Private Key to PKCS#8 Format Source: https://github.com/adoptium/api.adoptium.net/blob/main/CONTRIBUTING.md Use this command to convert your GitHub App RSA private key to PKCS#8 format, which is required for GitHub App authentication. ```bash openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in your-rsa-private-key.pem -out pkcs8-key.pem ``` -------------------------------- ### Stable URL for latest LTS Linux x64 JDK 17 Source: https://github.com/adoptium/api.adoptium.net/blob/main/docs/cookbook.adoc Stable URL that downloads the latest long-term supported (LTS) Linux x64 JDK version 17. Can be embedded in webpages or used in scripts. ```html https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64/jdk/hotspot/normal/eclipse ```