Where are Java preferences stored on Mac OS X?

2020-05-20 05:37发布

问题:

On Windows, the Java preferences, which you access in your application from java.util.prefs.Preferences are stored in the registry. Where are those stored on Mac OS X?

回答1:

From Apple Developer Connection:

The preferences files generated by the Preferences API are named com.apple.java.util.prefs. The user’s preferences file is stored in their home directory (~/Library/Preferences/). The system preferences are stored in /Library/Preferences/ and are only persisted to disk if the user is an administrator.



回答2:

Also, note that if the preference is nested enough, it won't directly be in com.apple.java.util.prefs, but rather in its own file. For instance, if you have a node /a/b/c, the key/value pairs for that node will be stored in a.b.c.plist.

The file will be either in ~/Library/Preferences/ or /Library/Preferences/, as for the com.apple.java.util.prefs file.