Java examples for Native OS:Preference
Retrieving the Parent and Child Nodes of a Preference Node
import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; public class Main { public static void main(String[] argv) { // Get a node Preferences prefs = Preferences.userNodeForPackage(java.lang.String.class); // Get the parent Preferences node = prefs.parent(); // /java node = node.parent(); // null // Get the names for nodes under java.lang String[] names = null;//from w ww . ja v a 2 s . c o m try { names = prefs.childrenNames(); } catch (BackingStoreException e) { } // Get the child nodes using the names for (int i = 0; i < names.length; i++) { node = prefs.node(names[i]); } } }