Java Code Formatter

If anyone is interested in a Command Line app to format single or batches of Java code files

www.rdsisemore.com/JavaFormatter.zip

  • it is written in Swift so it works only on macOS
  • it is a Command Line app that can be called from Terminal -or- a Shell
  • it moves any { to the end of the previous line (honoring any comments that might follow)
  • it handles both line and block comments
  • removes TABS and indents by 3 spaces as is appropriate
Usage: JavaFormatter SourceFile.java [DestinationFile.java] [-overwrite]
       JavaFormatter SourceFile.java DestinationFolder      [-overwrite]
       JavaFormatter SourceFolder DestinationFolder         [-overwrite]

Since this DOES modify the code, I highly suggest doing your own testing to insure I haven’t overlooked something that might bork up your code… If you do, please let me know

If you download and use it, let me know that too :slight_smile:

1 Like

two anomolies where just fixed [Oct8, 2:30pm PST]