|
3 | 3 | ## Installation |
4 | 4 |
|
5 | 5 | 1. Run `./gradlew :open-java-format-eclipse-plugin:build` in the main folder, |
6 | | -1. If running Eclipse under JRE 17 or later add these options to `eclipse.ini` after `-vmargs`: |
| 6 | +1. Eclipse has to run on Java 21 or later, as current Eclipse packages do. The formatter reaches into |
| 7 | + javac, so add these options to `eclipse.ini` after `-vmargs`: |
7 | 8 | ``` |
8 | | - --add-exports |
9 | | - jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED |
10 | | - --add-exports |
11 | | - jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED |
12 | | - --add-exports |
13 | | - jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED |
14 | | - --add-exports |
15 | | - jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED |
16 | | - --add-exports |
17 | | - jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED |
| 9 | + --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED |
| 10 | + --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED |
| 11 | + --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED |
| 12 | + --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED |
| 13 | + --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED |
18 | 14 | ``` |
| 15 | + Keep each option and its value on one line, joined by `=`: the Eclipse launcher starts the JVM |
| 16 | + inside its own process, and an option split over two lines does not take effect — formatting then |
| 17 | + fails with an `IllegalAccessError` in the workspace log. |
19 | 18 | 1. Copy `open-java-format-eclipse-plugin/build/libs/open-java-format-eclipse-plugin-<version>.jar` to the `dropins` folder of your Eclipse installation, |
20 | | -1. Run `eclipse -clean`. |
| 19 | +1. Run `eclipse -clean`, |
| 20 | +1. Pick `open-java-format` in Window → Preferences (Eclipse → Settings on macOS) → Java → Code Style → |
| 21 | + Formatter → Formatter implementation. |
0 commit comments