actions/Setup Java JDK

Set up a specific version of the Java JDK and add the command-line tools to the PATH

View on GitHub

Trust Signals

Scorecard Score
Scorecard 4–6scored Jul 13, 2026
Maintenance Recency
Activelast commit Jul 10, 2026
License
MIT

Pinned Snippet

workflow.ymlSHA-pinned
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0

tags can be moved; commit SHAs can't. why a SHA?

namedescriptionrequireddefault
java-versionThe Java version to set up. Takes a whole or semver Java version, or the "latest" alias to use the newest available stable release. See examples of supported syntax in README fileno
java-version-fileThe path to a file containing the Java version to set up (.java-version, .tool-versions, .sdkmanrc). Used when java-version is not set. See examples of supported syntax in README fileno
distributionJava distribution. See the list of supported distributions in README file. This input is required except when java-version-file points to .sdkmanrc with a recognized distribution suffix (e.g., java=21.0.5-tem).no
java-packageThe package type (jdk, jre, jdk+fx, jre+fx, jdk+crac, jre+crac)nojdk
architectureThe architecture of the package (defaults to the action runner's architecture)no
jdk-filePath to where the compressed JDK is locatedno
jdkFileDeprecated alias for `jdk-file`. Path to where the compressed JDK is located. Use `jdk-file` instead; this alias may be removed in a future release.no
check-latestSet this option if you want the action to check for the latest available version that satisfies the version specnofalse
set-defaultSet this option to false if you want to install a JDK but not make it the default. When false, JAVA_HOME and PATH are not updated, but JAVA_HOME_<major>_<arch> is still set.notrue
verify-signatureVerify downloaded Java package signatures when supported by the selected distributionnofalse
verify-signature-public-keyASCII-armored GPG public key used to verify the downloaded package signature. Overrides the default bundled key for the selected distribution.no
server-idID of the distributionManagement repository in the pom.xml file. Default is `github`nogithub
server-username-env-varEnvironment variable name for the username for authentication to the Apache Maven repository. Default is $GITHUB_ACTORno
server-usernameDeprecated alias for server-username-env-varno
server-password-env-varEnvironment variable name for password or token for authentication to the Apache Maven repository. Default is $GITHUB_TOKENno
server-passwordDeprecated alias for server-password-env-varno
settings-pathPath to where the settings.xml file will be written. Default is ~/.m2.no
overwrite-settingsOverwrite the settings.xml file if it exists. Default is "true".notrue
gpg-private-keyGPG private key to import. Default is empty string.no""
gpg-passphrase-env-varEnvironment variable name for the GPG private key passphrase. Defaults to GPG_PASSPHRASE when gpg-private-key is set.no
gpg-passphraseDeprecated alias for gpg-passphrase-env-varno
cacheName of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt".no
cache-dependency-pathThe path to a dependency file: pom.xml, build.gradle, build.sbt, etc. This option can be used with the `cache` option. If this option is omitted, the action searches for the dependency file in the entire repository. This option supports wildcards and a list of file names for caching multiple dependencies.no
job-statusWorkaround to pass job status to post job step. This variable is not intended for manual settingno${{ job.status }}
tokenThe token used to authenticate when fetching version manifests hosted on github.com, such as for the Microsoft Build of OpenJDK. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.no${{ github.server_url == 'https://github.com' && github.token || '' }}
mvn-toolchain-idName of Maven Toolchain ID if the default name of "${distribution}_${java-version}" is not wanted. See examples of supported syntax in Advanced Usage fileno
mvn-toolchain-vendorName of Maven Toolchain Vendor if the default name of "${distribution}" is not wanted. See examples of supported syntax in Advanced Usage fileno
show-download-progressWhether Maven should print artifact download/transfer progress to the build log. When "false" (default) the action sets "-ntp" (--no-transfer-progress) in MAVEN_ARGS to produce cleaner logs. Set to "true" to keep the progress output. Has no effect on non-Maven builds.nofalse
problem-matcherWhether to register the Java problem matcher (compiler errors/warnings and uncaught exceptions). Set to "false" to disable annotations.notrue
namedescription
distributionDistribution of Java that has been installed
versionActual version of the java environment that has been installed
pathPath to where the java environment has been installed (same as $JAVA_HOME)
cache-hitA boolean value to indicate an exact match was found for the primary key
cache-primary-keyThe primary cache key computed by the action for the configured build tool. Empty when caching is not enabled or when caching is skipped (e.g. cache service unavailable). Useful for composing with actions/cache or actions/cache/restore across jobs.