How do I create a profile to format Java code in Eclipse?
Author: Deron Eriksson
Description: This tutorial shows how to create a profile to format Java code in Eclipse.
Tutorial created using: Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1)
(Continued from page 1)
I hit Control-Shift-F to format the TestServlet.java file according to the new "myprofile" profile. Notice that the line wrapping is now different since I changed the "Maximum line width" from 80 to 120.
Profiles are a nice feature that allow for customized code formatting so that you can format your code the way you like it. Profiles are particularly useful in a team development environment since they allow multiple developers to format their code according to the same formatting rules. This is very handy when it comes to formatting version-controlled files, since it prevents unnecessary file changes as a result of different developers applying different formatting rules to the same file.