views:

543

answers:

2

Is there a way to use the formatter that comes with eclipse, outside of eclipse? I would like to format some java files using my formatter.xml file that I have configured using eclipse. Does anyone have any code examples that would allow me to do this? I would also like to use this standalone, so the specific jars that are used would be nice.

+1  A: 

Never tried to pull something like that off, but I remember seeing once a class called:

org.eclipse.jdt.core.formatter.CodeFormatterApplication

Perhaps that is some standalone entry point into the formatting mechanism, though I've never tried or investigated further.

Uri
+5  A: 

edit: Nevermind what I said before, but I did find this:

http://www.peterfriese.de/formatting-your-code-using-the-eclipse-code-formatter/

Apparently you can directly invoke Eclipse's code formatter from the command line.

dancavallaro