I want to use the java.util.Preferences API but I don't want my program to attempt to read or write to the Windows registry. How would I go about this?
views:
1522answers:
2It is always possible to extend java.util.prefs.AbstractPreferences.
An alternative could be to use The Configuration package of Apache Commons allows you to read and write configuration data from/to different sources.
I trust you have read the read/write to Windows Registry using Java and you then want to have another back-end than the registry when using the java.util.Preferences API
As this gentleman, you could extend the Preference API
As specified in this java sun article:
Because the Preferences API is back-end neutral, you need not care whether the data are stored in files, database tables, or a platform-specific storage such as the Windows Registry.
An example of such an extension through a new PreferenceFactory can be seen here.
That is better, IMO, than to use another API.