Get keys from Preferences
import java.io.FileOutputStream; import java.util.prefs.Preferences; public class PreferenceExample { public static void main(String args[]) throws Exception { Preferences prefsRoot = Preferences.userRoot(); Preferences myPrefs = prefsRoot.node("PreferenceExample"); myPrefs.put("A", "a"); myPrefs.put("B", "b"); myPrefs.put("C", "c"); System.out.print("Node's keys: "); for (String s : myPrefs.keys()) { System.out.print(s + ""); } } }