Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to format all java files as per Sun's or Eclipse Standards ?

 
Harikrishna Gorrepati
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please advice on how to change all/ java related files in my project to Sun's or Eclipse Standards ?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a very nice app called Jalopy that can do bulk pretty-printing according to a very customizable set of rules, including the Sun ones. It can be run stand-alone from the command line or as a plug-in to Eclipse (and IntelliJ, for that matter).

However, I believe that if you right (menu) click in the Explorer view on the directory that contains the Java files of interest, select Source/Format, all of the Java files in that directory and its children will be run through the formatter. I do recommend making a backup first, though.
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before using the "Source->Format" option, you need to be sure that it is set-up as you want it to be, and maybe you need to run the "Source->Clean Up..." options first - and then maybe you also want to perform a "Save Actions" each time you save your code....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic