The difficulty is that it should be cross platform. Windows 2000, XP, Vista, OSX, Linux, other unix variants. I am looking for a snippet of code that can accomplish this for all platforms, and a way to detect the platform.
Now, you should be aware of bug 4787931 that
user.home does not work correctly, so please do not provide me of textbook answers, I can find these myself in the manuals.