Eclipse Tip: Compress package names



In general Java package names seems to be long thanks to the guidelines that it should start with your company’s URL (eg com.vasanthdharmaraj.java.xxx). Such package names makes it difficult to navigate the packages in Eclipse’s Package Explorer. The beginning and the visible part of all packages seem to be identical. In most cases only the last part is useful. Eclipse has a nice feature to compress package names. Go to Window > Preferences > Java > Appearance. Check the “Compress all packages…” check box and add the pattern in which you want to compress. A pattern is a number followed by a character – “1.“. The number denotes the number of characters per package name to be shown and the character is appended after this. For the pattern “1.” the following is the output.


Vasanth Dharmaraj is a Java Architect currently working for Western Union living in the Bay Area. He is interested in programming, gadgets, formula one... You can follow him on Twitter.

Posted in Eclipse, Java

Ads By Google