Where are Java preferences stored on Mac OS X?

Viewed 55107

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?

3 Answers

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.

When I create preferences objects using code:

package pl.marcinchwedczuk.iunrar.gui;

public class AppPreferences {
    private final Preferences preferences = Preferences
            .userNodeForPackage(AppPreferences.class);

Then the settings will be stored in:

/Users/$USER/Library/Preferences/pl.marcinchwedczuk.iunrar.plist

(for some reason gui part is missing, tested on macOS BigSur).

Also remember to call .flush() on preferences objects.

Related