As an exercise for the reader, I have prepared a simple tool that reads and writes a user preference.
Download the full source code.
NOTE: If you are using the cafe distribution, you must make sure at least there is a copy of the required xerces jars in TOMCAT_HOME/shared/lib. At the time of writing, these were the jar files that were copied into place:
xerces-2.4.0.jar
xmlParserAPIs-2.6.2.jar
xercesImpl-2.6.2.jar
If you run "maven bld" from the demo source directory, the required jars should exist in your local .maven/repository directory.
There should only be one version of each jar file in TOMCAT_HOME/shared/lib.