While creating a Java solution that shall be deployed at least on Windows, Linux, Mac OS and Android we are looking for a way to keep system wide configuration data.
in What is the proper way to store app's conf data in Java? the solutions are discussed around a specific user's home directory. On one of Oracle's documentation pages:
http://docs.oracle.com/javase/7/docs/technotes/guides/deployment/deployment-guide/properties.html
a similiar approach ist taken.
We'd like to go a more system wide route. E.g. on a linux system a subdirectory of /etc or /var/lib might be a suitable location. On Windows /$WIN/System32 might be a start, on Mac OS /System/Library might be the location.
JAVA_HOME - might be an option but has it's own issues: Windows ignores JAVA_HOME: how to set JDK as default?
The java.util.Preference class has been around a while but id does not supply a proper choice of BackingStore locations: http://www.allaboutbalance.com/articles/disableprefs/
What would be a library that allows to
- find out the proper system wide directory
- add an application specific subfolder
- and may be handle the properties (this could be done with regular properties files or java.util.Preferences)
The first part of the question is about the proper location in a platform independent approach. What directories should be used e.g. on Android? And what followup problems have to be handled (e.g. access rights)? The assumption would be that if a library exists the first part of the question would be answered by the way the library deals with this part of the question. So if you think there is no such library you are invited to give your answer to this part of the question.