Eclipse Formatter for Java (EFJ)

About

EFJ is a pseudo-Eclipse Rich Client Platform application (RCP). I say pseudo because technically this is not an RCP app but more of a GUI-less version of Eclipse (see the Issues section for some discussion of this). EFJ is made by taking Eclipse and ripping out the plugins that are necessary to run jdt.core.

The main motivation for EFJ comes from a request of a few GNU Classpath developers. They wanted to use Eclipse's Java formatter without having to install the entire Eclipse Platform, JDT or a GUI toolkit. I believe that they want to be able to run a nightly cron job which checks out the code, formats it and checks it back in. EFJ could also be used in a server side commit hook.

EFJ is best suited for the applications listed above (ie server side stuff). If you don't have special requirements, you should consider using the EFJ that is included with the various packaged versions of Eclipse. Currently the Eclipse in Fedora Core 4 has the EFJ patch and I will be trying to get it into other packages (ie Debian and Gentoo). I've submitted the patch to the JDT developers with the hopes that it will be committed upstream sometime in the future.

Building

To build EFJ, just run the default ant task in build.xml. This will build the plugins required to run EFJ and put them in the "plugins" directory and will put startup.jar in the top level directory.

Running

To run EFJ, do the following:

  % java -cp startup.jar org.eclipse.core.launcher.Main \
      -application org.eclipse.jdt.core.JavaCodeFormatter

This will print out usage instructions. You can also use the "efj" wrapper script that is included. If you put the wrapper someplace outside this directory, be sure to change the classpath path to include the location of startup.jar.

If enough people start using this, I can look into making EFJ installable.

Issues

EFJ is really just Eclipse with no GUI dependencies. As a consequence of this, a configuration directory will be created in the same directory as startup.jar. If this directory is not writable, it will try to make a .eclipse/configuration directory in your home directory. I might be able to work around this problem by doing a one time configuration step after the build is complete. The tool to do this is the works (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=90535).

You may also notice that an empty workspace directory is created in the directory that efj is called from. Once again this is because EFJ is just a GUI-less version of eclipse. I will try to find a way to disable this.

Downloads

efj-3.1.1.tar.bz2 <--- latest
efj-3.1.0.tar.bz2
efj-3.1M6.0.tar.bz2
efj-3.0.1.tar.bz2

Questions

If you have any questions or comments, feel free to email me.

Ben Konrath [ben -at- bagu ~dot~ org]