Can you show me a small snippet of how to use Preferences API in JDK1.4?
Created Feb 28, 2002
Davanum Srinivas
Working with preferences
import java.util.prefs.*;
import java.io.*;
public class ExportPrefs {
public static final String APPLICATIONPATH = "applicationpath";
public static final String USERFONT = "userfont";
public static final String LASTUSERLOGIN = "lastuserlogin";
public void go() throws BackingStoreException {
try {
Preferences preferences =
Preferences.userNodeForPackage(this.getClass());
preferences.put(APPLICATIONPATH, "c:application");
preferences.put(USERFONT, "Courier New");
preferences.put(LASTUSERLOGIN, "Joris Van den Bogaert");
preferences.flush();
} catch (BackingStoreException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
ExportPrefs exportPrefs = new ExportPrefs();
exportPrefs.go();
}
}
More information can be found at:Working with preferences