|
| 1 | +This action downloads a Java Development Kit (JDK) built by Oracle and installs it using actions/setup-java. |
| 2 | + |
| 3 | +JDKs built by Oracle are Oracle JDK and Oracle OpenJDK. |
| 4 | + |
| 5 | +Input Overview |
| 6 | +Input Name Default Value Description |
| 7 | +website oracle.com From where the JDK should be downloaded from. |
| 8 | +release 20 Java feature release number or name of an Early-Access project. |
| 9 | +version latest An explicit version of a Java release. |
| 10 | +install true Install the downloaded JDK archive file. |
| 11 | +install-as-version empty Control the value passed as java-version |
| 12 | +uri empty Custom URI of a JDK archive file to download. |
| 13 | +Input website |
| 14 | +The website input specifies from where the JDK should be downloaded from. It defaults to oracle.com. |
| 15 | + |
| 16 | +Following values are supported: |
| 17 | + |
| 18 | +oracle.com for Oracle JDK 17 and later. |
| 19 | + |
| 20 | +This action only supports Oracle JDKs provided under the Oracle No-Fee Terms and Conditions License. |
| 21 | + |
| 22 | +jdk.java.net for the current OpenJDK General Availability build and for OpenJDK Early-Access builds. |
| 23 | + |
| 24 | +Early-Access builds include the mainline JDK, Generational ZGC, Project Loom and jextract, Panama, Valhalla, etc. |
| 25 | + |
| 26 | +The jdk.java.net-uri.properties file provides a set of key-value pairs mapping OpenJDK descriptions to their download links. |
| 27 | + |
| 28 | +Input release |
| 29 | +The release input denotes a Java feature release number (17, 18, ...) or a name of an Early-Access project (loom, ...). It defaults to the current General-Availability Release for the Java SE platform., which is 20 as of today. |
| 30 | + |
| 31 | +Note that websites may offer a different set of available releases. For example, oracle.com only offers releases of 17 and above; it does not offer any Early-Access releases. |
| 32 | + |
| 33 | +Note also that websites may stop offering any release at any time. Please consult the website for details which release is offered for how long. |
| 34 | + |
| 35 | +Input version |
| 36 | +The version input can be used to specify an explicit version of a Java release, ex. 17.0.1. It is set by default to latest. |
| 37 | + |
| 38 | +WARNING! |
| 39 | + |
| 40 | +Older versions of the JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production. |
| 41 | + |
| 42 | +Input install |
| 43 | +The install input enables or disables the automatic JDK installation of the downloaded JDK archive file. It is enabled by default by using true as its value. |
| 44 | + |
| 45 | +This action delegates to actions/setup-java in order to install the downloaded JDK archive file using default Pass false to skip the automatic JDK installation and invoke actions/setup-java with your custom settings. |
| 46 | + |
| 47 | +Input install-as-version |
| 48 | +The install-as-version input allows overriding the value passed as java-version to the underlying actions/setup-java action. |
| 49 | + |
| 50 | +Supported values of install-as-version include: |
| 51 | + |
| 52 | +PARSE_URI parses the computed or given URI for a valid Java version string, ex. 17.0.1. |
| 53 | +HASH_URI returns the hashCode() of the computed or given URI as a string, ex. 12345. |
| 54 | +All strings supported by actions/setup-java |
| 55 | +The default value of install-as-version depends on the release input documented above: |
| 56 | + |
| 57 | +If release input starts with a digit, install-as-version defaults to PARSE_URI. |
| 58 | +If release input does not start with a digit, install-as-version defaults to HASH_URI. |
| 59 | +Input uri |
| 60 | +Use the uri input to download a JDK from the specified URI originating from a supported website. The value of inputs website, release, and version ignored. |
| 61 | + |
| 62 | +Examples for oracle.com |
| 63 | +The following examples use the JDK Script Friendly URLs to download and set up binaries that are made available under the Oracle No-Fee Terms and Conditions License. |
| 64 | + |
| 65 | +Download and install the latest version of Oracle JDK |
| 66 | +steps: |
| 67 | + - name: 'Set up latest Oracle JDK 17' |
| 68 | + uses: oracle-actions/setup-java@v1 |
| 69 | + with: |
| 70 | + website: oracle.com |
| 71 | + release: 17 |
| 72 | +Download and install a specific version of Oracle JDK |
| 73 | +steps: |
| 74 | + - name: 'Set up archived Oracle JDK 17.0.1' |
| 75 | + uses: oracle-actions/setup-java@v1 |
| 76 | + with: |
| 77 | + website: oracle.com |
| 78 | + release: 17 |
| 79 | + version: 17.0.1 |
| 80 | +WARNING! |
| 81 | + |
| 82 | +Older versions of the JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production. |
| 83 | + |
| 84 | +Examples for jdk.java.net |
| 85 | +The following examples download and install OpenJDK binaries that are made available under the GNU General Public License, version 2, with the Classpath Exception. |
| 86 | + |
| 87 | +Download and install an OpenJDK build of a given release |
| 88 | +steps: |
| 89 | + - name: 'Set up latest JDK N from jdk.java.net' |
| 90 | + uses: oracle-actions/setup-java@v1 |
| 91 | + with: |
| 92 | + website: jdk.java.net |
| 93 | + release: N # Replace N with GA, EA, 17, 18, 19, ... |
| 94 | +Download and install an Early-Access build of a named OpenJDK project |
| 95 | +steps: |
| 96 | + - name: 'Set up Early-Access build of a named project from jdk.java.net' |
| 97 | + uses: oracle-actions/setup-java@v1 |
| 98 | + with: |
| 99 | + website: jdk.java.net |
| 100 | + release: loom # or panama, valhalla, ... |
| 101 | +Supported GitHub Actions Virtual Environments |
| 102 | +All environments that have Java 17 pre-installed are supported. These include the following labels: ubuntu-latest, macos-latest, and windows-latest. |
| 103 | + |
| 104 | +More information |
| 105 | +Make sure to check the annoucement and the FAQ on Inside Java. |
| 106 | + |
| 107 | +Status |
0 commit comments