Previously, if you needed to format a batch of code using a command line utility, you would have to use a course code formatter like Jalopy or Jindent. With 3.2, Eclipse has its own built-in code formatter, thanks to Ben Konrath of Red Hat.
Peter Friese tells gives you a how to:
To create the configuartion file, select one of your existing projects, and activate project specific formatter setting: Properties -> Java Code Style -> Formatter -> Enable project specific settings. Configure the code formatter as desired and then click Ok when you are done.
Using Using a file explorer, navigate to //.settings and copy org.eclipse.jdt.core.prefs to a new location. To invoke the code formatter using the command line issue the following command: \eclipse.exe -vm \java.exe -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config \org.eclipse.jdt.core.prefs \*.java
Friese further adds that in case the formatter complains about your code, that could be because your code probably contains Java 5 constructs. You can add the following lines to your config file to make it work: org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.source=1.5