eclipse

Toggle view

eclipse the memory hog

Occasionally I have to help people with this painful java.lang.OutOfMemoryError: PermGen space because it is running out of PermGen space. Here I have found a good article explaining the necessary setting – in future I can just direct them to my posting and they can help themselfes :)

Maven2 eclipse web tools platform integration

When developing web applications it’s always been a hassle to keep the WEB-INF/lib folder up to date especially when starting to experiment with different versions of libraries or frameworks .
In the past (since being a Maven2 user) I helped myself with issuing the mvn war:inplace command to pull in all required libraries into WEB-INF/lib. So, occasionally I only would update my POM and rerun the command to have the latest versions of jars in my project!

This is extremely handy when using profiles for example to switch dependencies between a set of JSF 1.1 or JSF 1.2 libraries. Only with a twinkle I could change the classpath definition for any project. Ok so far this is nice.

For server development I’m working with the WTP plugin which makes handling a server a bit easier. So, regarding my library dependencies I’d feel more comfortable if they were updated every time I started my server (and thus publish the latest project files to the server).

Maven Library Container

So, I updated my m2eclipse plugin to 0.0.11 and tried to mark the Maven Dependencies Library Container as a J2EE Dependency, restarted my Web Container and was really excited that finally this is supported now. This means all of my dependencies from pom.xml are actually deployed to the server.

Eclipse Type Browser Filter

As Java evolves it grows continually in terms of numbers of classes. Type browsing is getting more and more a tiring task even when using wildcards and the camel case search notation. Just too many internal classes appear that are not supposed to be used by clients anyway (they make up the internal implementation of Java APIs). So this is a good reason to hide them anyway.

So go to Preferences->Java->Appearance->Type Filters and add any package or type filter. I have found useful to add at least

  • com.sun.*
  • sun.*
  • sunw.*

eclipse user libraries

Since user libraries have been introduced in eclipse 3.x I had never liked to use user libraries. They lack support for portability. It is just not possible to share user libraries. Once defined, a user library contains hard coded paths to all of the referenced libraries. User libraries lack the utilization of path variables.

Now since user libraries have been adopted by various eclipse sub projects (WTP, DALI, …) this thing even got worse. For example you defined 2 user libraries (e.g. JPA and JSF) with references to the same library (i.e. the same file path) then eclipse would just refuse to add both user libraries and report a duplicate entry error for the classpath. I have reported this in eclipse bugzilla.

Support of variables within user libraries has been pending for a while, see eclipse bugzilla.

eclipse encoding settings

Encoding is a pretty troubling topic if not care is taken! So you better make sure which settings your favourite IDE is using. Typically UTF-8 is the most flexible ! Here is a short summary how to set it up for eclipse.

  1. For a global encoding setting add -Dfile.encoding=UTF-8 to eclipse.ini.
  2. For setting the encoding on a per workspace basis, use Preferences->General->Workspace!
  3. To set the encoding on a per project basis us the tip as documented here. Or shortly open project properties and change to UTF-8

The last one I guess should be the preferred as it does not rely on individual developers to setup their IDE properly, the settings are stored locally with the project.

green red blue grey