2.98.0.1
Code-wise this is palantir-java-format 2.98.0, renamed to open-java-format. What changed is the build: every file of this release, here and on Maven Central, was built and signed on GitHub Actions.
For now the fourth number counts rebuilds of the upstream version: 2.98.0.1 is the first build of 2.98.0.
Requirements: Java 21 or later. The Gradle plugins need Gradle 9.
Style flag: --ojf
Without a style flag the formatter uses Google Java Style. --ojf (or -ojf) selects the 120-column style that --palantir used to; --palantir is no longer accepted. The jar and the native binaries take the same flags.
Runnable jar
open-java-format-2.98.0.1-all.jar carries every dependency and the Add-Exports the formatter needs, so no JVM flags are required:
curl -LO https://github.com/openjavaformat/open-java-format/releases/download/2.98.0.1/open-java-format-2.98.0.1-all.jar
java -jar open-java-format-2.98.0.1-all.jar --ojf --replace Foo.javaNative binaries
No Java needed. Pick the file for your platform:
| Platform | File |
|---|---|
| Linux x86-64 (glibc) | open-java-format-linux-glibc_x86-64 |
| Linux AArch64 (glibc) | open-java-format-linux-glibc_aarch64 |
| macOS Apple silicon | open-java-format-macos_aarch64 |
| macOS Intel | open-java-format-macos_x86-64 |
curl -LO https://github.com/openjavaformat/open-java-format/releases/download/2.98.0.1/open-java-format-macos_aarch64
chmod +x open-java-format-macos_aarch64
./open-java-format-macos_aarch64 --ojf --replace Foo.javamacOS refuses to run a binary downloaded with a browser; clear the quarantine flag first with xattr -d com.apple.quarantine open-java-format-macos_aarch64. There is no Windows binary yet — use the jar.
Handy flags
| Flag | What it does |
|---|---|
--replace, -i |
Write the result back to the files instead of printing it |
--dry-run --set-exit-if-changed |
Print the files that would change and exit with 1, for CI |
- |
Format stdin to stdout |
--help |
List every option |