I recently looked into the java.util.prefs.Preferences as long as a tutorial mentioned this as a possibility to save application preferences.

Two questions are coming up for me:

1. I am not sure if I should like that java.util.prefs.Preferences - they tell using it under Windows save something to the registry and under Linux to file system. Actually I do not like to save settings to the registry and I want to minimize differences of the behaviour of my application under different operating systems.

How do you store your application settings?


2. In general I can find the user home path using
Java Code:
System.getProperty("user.home");
This folder can be used to save some user settings using different methods.

But how can I get to some common path (same for all users) - like /etc or <Documents and Settings>\All Users?

Further getting the application path seems to be a little difficult.
Java Code:
Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()
does not seem to be reliable because it brings different outputs whether I run the application in debugger or if calling it directly from commandline.

Where do you store application specific settings (not user specific settings) - and how do you find out that path?