Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Eclipse has a powerful code formatter for Java, but I am wondering whether it is possible to define a code format on a per file basis, instead of defining the format for all java files?


share|improve this question
Can you explain how this might be useful? –  Karan Mar 31 '13 at 17:08
Well, for example you could use some code from vendor, which uses a different coding style. But sometimes you may need to modify it a little bit. @Karan –  xuhdev Apr 24 '13 at 18:56
Well Eclipse is going to format as Java based on the file extension, so one possible way might be to rename the ones you want a different/custom format for to some other extension, then define your desired formatting rules for files with that new extension. Of course, changing extensions quite likely will cause issues, so I don't know how else one might do this without undesirable side-effects. Perhaps if there's a way to make Eclipse select different formatting rules based on some unique string inside the Java files. Maybe there's a plugin that does this... –  Karan Apr 24 '13 at 20:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.