The JDT has a command line Eclipse application that allows users to format Java source code either with the Eclipse default code formatter options or with custom options.
Running the formatter application
Code Formatter