Java Sources and Documentation under Mac for Eclipse/NetBeans

A couple of days ago I received my new MacBook Pro! After some first struggles with Mac OS X and shortcuts, I am now starting to feel comfortable and I learn more and more each day. I was a 60 % Windows and 40 % Linux user and my forecast is that in one year I will be 70 % Mac, 15 % Windows, and 15 % user. However, there are some bumps on the road to Mac-land.

Mac ships with Java 1.5 and 1.6 is available too. The problem is that only binaries are installed and as a serious developer you need also sources and documentation. So to get them, you have to join the Apple Developer Connection (the free version does it) and download the  Java for Mac OS X 10.5 Update 2 Developer Documentation (or probably a higher version in the future). The download is around 130 MB and includes sources/documentation for Java 1.5 and 1.6. Probably you have to set the src.jar and docs.jar manually to existing JVMs or just delete and add the existing ones.

Eclipse: Preferences - Java - Installed JREs - Select Installed JRE and click Edit

Eclipse set JVM
Eclipse set JVM

NetBeans: Tools - Java Platform - Add or select the right Tab

NetBeans set JVM
NetBeans set JVM

heli's blog heli 16 Nov 2008 No Comments

Beware the ClassCastException (a tale of a native Memory Leak)

I had quite an interesting bug hunting last week in one of our extern engagements. In summer a memory leak was discovered in a new used third party library. Back then, we started with testing using Java profilers (Java SDK ships a good enough profiler - visual vm). Surprisingly, we found nothing; the heap didn’t grow, number of threads remained the same, … in short, the usual suspects seemed innocent. Due to some other projects, we hadn’t enough time to do more testing, and so we just informed the company that sells the library about the issue. After some weeks, the company’s response was a we-dont-have-a-memory-leak-your-testing-is-wrong response (they suggested memory consumption is probably because of a different virtual machine and I have to admit that the task manager was also used to view the memory growth, which isn’t the tool to convince any real developer that there is a memory leak). However, the problem became urgent (like software problems tend to do) when the application was stress tested in real environment for a real customer. This project will be the first shipping with the new library. The application failed after approximately 6 hours due to a java.lang.OutOfMemoryError … Out of swap space?.

Continue Reading »

heli's blog heli 10 Nov 2008 1 Comment

Sometimes HashMaps are enough, part three

This part will be a short one because I have to pack for my vacation. Yes, I will leave this cold and miserable weather, heading south to fill up my energy again (I am running on solar power).

Last time we switched from a static approach to an instance based one and introduced a register-method to allow adding Singletons from everywhere. There are several issues with this approach:

  • doesn’t support lazy initialization, so far only eager initialization was done
  • sometimes not all necessary information is available at register time to actually create the Singleton instance
  • maybe you want to track, creation, requesting, and so forth of the Singleton.

Sounds complicated and scary? It isn’t, delegation is our friend again. Another way would be the observer (listener) pattern to address the above mentioned issues, however, delegation is more elegant and appropriate for this task.

Continue Reading »

heli's blog heli 07 Oct 2008 No Comments

Next Page »