Changes for docs/advanced-usage.md: 25 added lines, 0 removed lines.
Original line number
Diff line number
Diff line
@@ -168,6 +168,31 @@ steps:
-run:java -cp java HelloWorldApp
```
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:
```yaml
steps:
-name:fetch latest temurin JDK
id:fetch_latest_jdk
run:|
major_version={{ env.JAVA_VERSION }} # Example 8 or 11 or 17
**NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.