Reputation: 36746
I need persist some configurations of my sistem like options selected, user and password of database connection, etc.
I heard of system.properties and text files, but I dont know what is best or more appropriate.
EDIT: Currently I'm using a properties file, but I don't know if is the better way.
Upvotes: 1
Views: 187
Reputation: 396
Look at Commons Configuration http://commons.apache.org/configuration/
You mention passwords ... hmmm should those be encrypted in some way?
This looks like it could handle that for you: http://www.jasypt.org/encrypting-configuration.html
Not sure about the use of these together ... you might have to pick one.
Upvotes: 2
Reputation: 3761
I got good mileage from adapting an extension of Java Preferences: Java Preferences to a File, from davidc.net. When using Java Preferences unmodified, the preferences are saved in an OS specific location and saving or recovering preferences for the system as opposed to the user could run into access privilege issues.
Upvotes: 1
Reputation: 53516
Read up on Java Preferences which is built into the JRE. It will select the correct mechanism per environment (.config files in Linux and registry entries in Windows).
Upvotes: 2