Java examples for Native OS:Preference
Saving and Retrieving a Preference Value
import java.util.prefs.Preferences; public class Main { public void main(String[] argv) { Preferences prefs = Preferences.userNodeForPackage(Main.class); final String PREF_NAME = "name_of_preference"; // Set the value of the preference String newValue = "a string"; prefs.put(PREF_NAME, newValue);//from w w w. ja va 2s . c o m // Get the value of the preference; String defaultValue = "default string"; String propertyValue = prefs.get(PREF_NAME, defaultValue); // "a string" } }