Mega Code Archive

 
Categories / Java Tutorial / Development
 

Getting the Roots of the Preference Trees

import java.util.prefs.Preferences; public class Main {   public static void main(String[] argv) throws Exception {     // Get the system root     Preferences prefs = Preferences.systemRoot();     // Get the user root     prefs = Preferences.userRoot();     // The name of a root is ""     String name = prefs.name();     // The parent of a root is null     Preferences parent = prefs.parent();     // The absolute path of a root is "/"     String path = prefs.absolutePath();   } }