How to Get User Node from Preferences
From Java Example Source Code
Contents |
[edit] Overview - How to Get User Node from Preferences
This Java example program shows how to get user Preferences node.
[edit] Java Source Code
- Package: example.preferenceproperties
- File: PreferenceExample4.java
package example.preferenceproperties; import java.util.prefs.Preferences; public class PreferenceExample4 { 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.println("userNodeForPackage: " + Preferences.userNodeForPackage(PreferenceExample4.class)); } }
[edit] What Result You Can Get
Run the program, you will get:
userNodeForPackage: User Preference Node: /example/preferenceproperties
[edit] Required External Libraries and/or Files for this Java Example
Need nothing.
[edit] How to Run this Java Example Program
We recommend running this Java example program with Eclipse.
For assistance in working with Eclipse, please see How to Run Java Program with Eclipse.
It's fairly easy.
[edit] Question & Answer
Any question?
Click edit and post your question or answer here.
