Search code examples
javapreferences

Java Preferences API using a custom file?


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?


Solution

  • 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.