NEWS

 

 




| Printer Friendly | Post Reply
Using the Eclipse Code Formatter
Previously, if you needed to format a batch of code using a command line utility, you would have to use a course code formatter like Jalopy or Jindent. With 3.2, Eclipse has its own built-in code formatter, thanks to Ben Konrath of Red Hat.

Peter Friese tells gives you a how to:

To create the configuartion file, select one of your existing projects, and activate project specific formatter setting: Properties -> Java Code Style -> Formatter -> Enable project specific settings. Configure the code formatter as desired and then click Ok when you are done.

Using Using a file explorer, navigate to //.settings and copy org.eclipse.jdt.core.prefs to a new location. To invoke the code formatter using the command line issue the following command:
\eclipse.exe -vm \java.exe -application
org.eclipse.jdt.core.JavaCodeFormatter -verbose -config
\org.eclipse.jdt.core.prefs
\*.java

Friese further adds that in case the formatter complains about your code, that could be because your code probably contains Java 5 constructs. You can add the following lines to your config file to make it work:
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.source=1.5

  Read the post
 


Yatego Shopping with more than 4000 Shops and with over 1.8 Mio Products. Branchenbuch and over 500.000 Bücher. Inspiration with Themeworld and Technic. A mobilephone- and Handy Shop with Nokia Handy, Motorola Handy and Sony Handy. With our Bestseller easily find Schuhe, Jeans, Kinderschuhe or a Digitalkamera, perhaps a Canon Digitalkamera. More Bestseller: Modellbahn, Diddl and Poker. Find Schmuck or Silberschmuck as easy as an Apple Ipod, Weber Grill or an Akkuschrauber.


  About Us | Advertise | Contact | Feedback | Publisher Copyright © 2007 Software & Support Media.
Any Questions?   Imprint | Privacy Policy