Skip to content

Commit fa2c650

Browse files
brunoborgesCopilotCopilot
authored
docs: note jdkfile approach for Early Access / unreleased JDK builds (#1058)
* docs: note jdkfile approach for Early Access / unreleased JDK builds Clarify in advanced-usage that the existing 'jdkfile' distribution can be used to install Early Access (EA) or other unreleased JDK builds not provided directly by setup-java, by downloading the archive in a prior step and pointing jdkFile at it. Adds a concrete EA example. Addresses #612. Co-authored-by: Copilot <[email protected]> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]>
1 parent 1d56e31 commit fa2c650

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

docs/advanced-usage.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ steps:
286286
## Installing Java from local file
287287
If your use-case requires a custom distribution or a version that is not provided by setup-java, you can download it manually and setup-java will take care of the installation and caching on the VM:
288288

289+
> [!NOTE]
290+
> This approach also lets you use builds that setup-java does not provide directly, such as **Early Access (EA)** or other unreleased JDK builds (for example, an upcoming feature release or a Loom/Valhalla preview build). Download the desired archive in a prior step and point `jdkFile` at it; setup-java will extract, install, and cache it just like a supported distribution. When targeting multiple architectures, select the correct binary per architecture in your workflow (for example, with a build matrix).
291+
289292
```yaml
290293
steps:
291294
- run: |
@@ -301,6 +304,23 @@ steps:
301304
- run: java --version
302305
```
303306

307+
For example, to use an **Early Access** build from [jdk.java.net](https://jdk.java.net/), download the archive for your runner OS/architecture and install it via `distribution: 'jdkfile'` (example below assumes Linux x64):
308+
309+
```yaml
310+
steps:
311+
- run: |
312+
download_url="https://download.java.net/java/early_access/jdk25/36/GPL/openjdk-25-ea+36_linux-x64_bin.tar.gz"
313+
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
314+
- uses: actions/setup-java@v5
315+
with:
316+
distribution: 'jdkfile'
317+
jdkFile: ${{ runner.temp }}/java_package.tar.gz
318+
java-version: '25.0.0-ea.36'
319+
architecture: x64
320+
321+
- run: java --version
322+
```
323+
304324
If your use-case requires a custom distribution (in the example, alpine-linux is used) or a version that is not provided by setup-java and you want to always install the latest version during runtime, then you can use the following code to auto-download the latest JDK, determine the semver needed for setup-java, and setup-java will take care of the installation and caching on the VM:
305325
306326
```yaml

0 commit comments

Comments
 (0)