Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ steps:
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '25'
- run: java HelloWorldApp.java
- run: java --version
```

#### Azul Zulu OpenJDK
Expand All @@ -87,7 +87,7 @@ steps:
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '25'
- run: java HelloWorldApp.java
- run: java --version
```

#### Supported version syntax
Expand Down Expand Up @@ -221,7 +221,7 @@ steps:
distribution: 'temurin'
java-version: '25'
check-latest: true
- run: java HelloWorldApp.java
- run: java --version
```

### Testing against different Java versions
Expand All @@ -240,7 +240,7 @@ jobs:
with:
distribution: '<distribution>'
java-version: ${{ matrix.java }}
- run: java HelloWorldApp.java
- run: java --version
```

### Install multiple JDKs
Expand Down
40 changes: 20 additions & 20 deletions docs/advanced-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ steps:
with:
distribution: 'temurin'
java-version: '21'
- run: java -cp java HelloWorldApp
- run: java --version
```

### Adopt
Expand All @@ -49,7 +49,7 @@ steps:
with:
distribution: 'adopt-hotspot'
java-version: '11'
- run: java -cp java HelloWorldApp
- run: java --version
```

### Zulu
Expand All @@ -62,7 +62,7 @@ steps:
distribution: 'zulu'
java-version: '21'
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
- run: java -cp java HelloWorldApp
- run: java --version
```

### Liberica
Expand All @@ -75,7 +75,7 @@ steps:
distribution: 'liberica'
java-version: '21'
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
- run: java -cp java HelloWorldApp
- run: java --version
```

### Microsoft
Expand All @@ -87,7 +87,7 @@ steps:
with:
distribution: 'microsoft'
java-version: '21'
- run: java -cp java HelloWorldApp
- run: java --version
```

### Using Microsoft distribution on GHES
Expand Down Expand Up @@ -116,7 +116,7 @@ steps:
with:
distribution: 'corretto'
java-version: '21'
- run: java -cp java HelloWorldApp
- run: java --version
```

### Oracle
Expand All @@ -129,7 +129,7 @@ steps:
with:
distribution: 'oracle'
java-version: '21'
- run: java -cp java HelloWorldApp
- run: java --version
```

### Alibaba Dragonwell
Expand All @@ -142,7 +142,7 @@ steps:
with:
distribution: 'dragonwell'
java-version: '8'
- run: java -cp java HelloWorldApp
- run: java --version
```

### SapMachine
Expand All @@ -154,7 +154,7 @@ steps:
with:
distribution: 'sapmachine'
java-version: '21'
- run: java -cp java HelloWorldApp
- run: java --version
```

### GraalVM
Expand All @@ -168,8 +168,8 @@ steps:
distribution: 'graalvm'
java-version: '21'
- run: |
java -cp java HelloWorldApp
native-image -cp java HelloWorldApp
java --version
native-image --version
```

### JetBrains
Expand All @@ -186,7 +186,7 @@ steps:
with:
distribution: 'jetbrains'
java-version: '11'
- run: java -cp java HelloWorldApp
- run: java --version
```

The JetBrains installer uses the GitHub API to fetch the latest version. If you believe your project is going to be running into rate limits, you can provide a
Expand All @@ -202,7 +202,7 @@ steps:
java-package: 'jdk' # optional (jdk, jre, jdk+jcef, jre+jcef, jdk+ft, or jre+ft) - defaults to jdk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: java -cp java HelloWorldApp
- run: java --version
```

You can specify your package type (as shown in the [releases page](https://github.com/JetBrains/JetBrainsRuntime/releases/)) in the `java-package` parameter.
Expand All @@ -225,7 +225,7 @@ steps:
distribution: '<distribution>'
java-version: '11'
java-package: jdk # optional (jdk or jre) - defaults to jdk
- run: java -cp java HelloWorldApp
- run: java --version
```

## Installing custom Java architecture
Expand All @@ -238,7 +238,7 @@ steps:
distribution: '<distribution>'
java-version: '11'
architecture: x86 # optional - default value derived from the runner machine
- run: java -cp java HelloWorldApp
- run: java --version
```

## Installing Java from local file
Expand All @@ -256,7 +256,7 @@ steps:
java-version: '11.0.0'
architecture: x64

- run: java -cp java HelloWorldApp
- run: java --version
```

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:
Expand All @@ -281,7 +281,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is
jdkFile: ${{ runner.temp }}/java_package.tar.gz
java-version: {{ steps.fetch_latest_jdk.outputs.java_version }}
architecture: x64
- run: java -cp java HelloWorldApp
- run: java --version
```

## Testing against different Java distributions
Expand All @@ -302,7 +302,7 @@ jobs:
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
- run: java -cp java HelloWorldApp
- run: java --version
```

#### Testing against different platforms
Expand All @@ -322,7 +322,7 @@ jobs:
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- run: java -cp java HelloWorldApp
- run: java --version
```

## Publishing using Apache Maven
Expand Down Expand Up @@ -580,7 +580,7 @@ steps:
distribution: 'temurin'
java-version: '11'
mvn-toolchain-id: 'some_other_id'
- run: java -cp java HelloWorldApp
- run: java --version
```

In case you install multiple versions of Java at once you can use the same syntax as used in `java-versions`. Please note that you have to declare an ID for all Java versions that will be installed or the `mvn-toolchain-id` instruction will be skipped wholesale due to mapping ambiguities.
Expand Down