Just a word of caution to folks using the Java 1.4+ java.util.Preferences class...
I have an application that used the Xerces XML parser and the new Java Preferences class. Shortly after I upgraded to JBuilder 8, I discovered that on UNIX machines Java would think there was a problem with the XML files it created to persist the preferences in and I'd see messages like this when running my application in JBuilder:
Mar 6, 2003 6:32:25 PM java.util.prefs.FileSystemPreferences$11 run
WARNING: Invalid preferences format in /<path>/prefs.xml
Mar 6, 2003 6:32:55 PM java.util.prefs.FileSystemPreferences$11 run
WARNING: Prefs file removed in background
-Java would remove the offending preferences file, and you'd get that second message later when it tried to access it. BTW, you don't see this problem on Windows machines because Preferences are persisted in the Registry in a non-XML format.
After much wailing and gnashing of teeth, I was able to determine that it was the new version of Xerces that shipped with JBuilder 8 that conflicted with Preferences and caused this problem. -When Java went to parse the Preferences XML file, it would get an error because the new Xerces wants to be set up differently than the old. The answer for me was to convert my XML parsing code to use the new DocumentBuilderFactory and DocumentBuilder classes instead of instanciating Xerces directly, and eliminate Xerces from my path.
I mention all of this here because JFreeChart comes with JAXP, which also includes pieces of Xerces which again cause the conflict with Java Preferences. If you're using Preferences and you're not using the XML features of JFreeChart, you can solve this mysterious problem by taking gnujaxp.jar out of your path.
I hope I can save somebody else the consternation this caused me!
-Fran
Conflict with Java Preferences class
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact: