Preferences: systemRoot() : Preferences « java.util.prefs « Java by API






Preferences: systemRoot()

 



import java.util.prefs.Preferences;

public class Main {
  public static void main(String[] argv) throws Exception {
    // System preference nodes

    // Use a Class
    Preferences prefs = Preferences.systemNodeForPackage(java.lang.String.class);

    // Use an absolute path
    prefs = Preferences.systemRoot().node("/java/lang/String");

    // Use a relative path
    prefs = Preferences.systemRoot().node("/javax/swing");
    prefs = prefs.node("text/html");

    // User preference nodes

    // Use a class
    prefs = Preferences.userNodeForPackage(Main.class);

    // Use an absolute path
    prefs = Preferences.userRoot().node("/com/mycompany");

    // Use a relative path
    prefs = Preferences.userRoot().node("/javax/swing");
    prefs = prefs.node("text/html");
  }
}

   
  








Related examples in the same category

1.Preferences.MAX_KEY_LENGTH
2.Preferences.MAX_VALUE_LENGTH
3.Preferences: absolutePath()
4.Preferences: addPreferenceChangeListener(PreferenceChangeListener pcl)
5.Preferences: exportNode(OutputStream os)
6.Preferences: exportSubtree(OutputStream os)
7.Preferences: get(String key, String def)
8.Preferences: getBoolean(String key, boolean def)
9.Preferences: getByteArray(String key, byte[] def)
10.Preferences: getDouble(String key, double def)
11.Preferences: getFloat(String key, float def)
12.Preferences: getInt(String key, int def)
13.Preferences: getLong(String key, long def)
14.Preferences: importPreferences(InputStream is)
15.Preferences: keys()
16.Preferences: name()
17.Preferences: node(String pathName)
18.Preferences: nodeExists(String pathName)
19.Preferences: parent()
20.Preferences: put(String key, String value)
21.Preferences: putBoolean(String key, boolean value)
22.Preferences: putByteArray(String key, byte[] value)
23.Preferences: putDouble(String key, double value)
24.Preferences: putFloat(String key, float value)
25.Preferences: putLong(String key, long value)
26.Preferences: remove(String key)
27.Preferences: removeNode()
28.Preferences: userNodeForPackage(Class c)
29.Preferences: userRoot()