Is it possible to use Preferences API to store my application's settings in a custom file? From what I have read, in Windows preferences are stored in registry which is not a good idea imho and I want my app to save prefs to let's say D:\app.preferences. Is it possible?
Asked
Active
Viewed 1,628 times
3 Answers
6
the point of the Preferences
API is to make it so that the application programmer doesn't have to know anything about how the OS chooses to save user preferences. if you want to save preferences in a specific file, you can certainly do that. just use a Properties instance to read/write to the file you desire.
1
You can implement your own Preferences, just look at the Linux implementation which internally uses a file. You just wont be able to use the static methods in Preferences to get at the roots but you have to store them somewhere yourself.

Ingo Kegel
- 46,523
- 10
- 71
- 102
0
By exporting and importing the preferences you can have what you want. It will still also be stored in wherever/whatever OS-specific storage mechanism JAVA chooses

inor
- 2,781
- 2
- 32
- 42