GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • open-java-format
  • openjavaformat/open-java-format
  • Get started
  • Playground
  • AI agents
  • Style
  • Library rules
  • Migrate
  • Manifesto
  • About
  • Gradle plugin
  • Spotless
  • Maven plugin
  • Command line

This view

  • Original page
  • New address

GeezerVison is showing openjavaformat.dev — Eclipse - open-java-format

Eclipse¶

The plugin adds open-java-format as a formatter implementation for the Java editor. Eclipse has to run on Java 21 or later, as current Eclipse packages do.

Install¶

  1. Download open-java-format-eclipse-plugin-21.0.2.jar from the latest release.
  2. Open eclipse.ini and add these lines after -vmargs. The formatter reaches into javac, and these options allow it.

    eclipse.ini
    --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
    --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
    --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
    --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
    --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
    
  3. Copy the jar into the dropins folder of your Eclipse installation.

  4. Start Eclipse once with eclipse -clean.

Select the formatter¶

Open Window → Preferences, or Eclipse → Settings on macOS. Go to Java → Code Style → Formatter and pick open-java-format under Formatter implementation.

If formatting fails¶

An IllegalAccessError in the workspace log means the options from eclipse.ini did not reach the JVM. Keep each option and its value on one line, joined by =. The Eclipse launcher starts the JVM inside its own process, and an option split over two lines does not take effect.

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.