File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Preferences API and Mac (maybe XP also?!) OS, oddity/issue? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Preferences API and Mac (maybe XP also?!) OS, oddity/issue?" Watch "Preferences API and Mac (maybe XP also?!) OS, oddity/issue?" New topic

Preferences API and Mac (maybe XP also?!) OS, oddity/issue?

Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140

At the company I work for, we've got this software, written in Java, that's supposed to work with all OSes, all browsers, etc.

Apparently not.

The issue seems to be with the Preferences API, but I wanted to know if this was a known issue, or something unusual I didn't account for.

I get the following message when the applet starts, but only in the Mac running Firefox. Firefox on Windows runs just fine, as does IE 6 and Opera on Windows.

Here's what I get:

Java(TM) Plug-in: Version 1.4.2_09
Using JRE version 1.4.2_09 Java HotSpot(TM) Client VM
User home directory = /Users/admin
Proxy Configuration: No proxy

c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
MRJ Plugin for Mac OS X v1.0.1
java.lang.NoClassDefFoundError: Illegal name: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
at java.lang.ClassLoader.defineClass(
at sun.applet.AppletClassLoader.findClass(
at java.lang.ClassLoader.loadClass(
at sun.applet.AppletClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at javax.xml.parsers.FactoryFinder.newInstance(
at javax.xml.parsers.FactoryFinder.find(
at javax.xml.parsers.DocumentBuilderFactory.newInstance(
at java.util.prefs.XmlSupport.load(
at java.util.prefs.XmlSupport.importPreferences(
at java.util.prefs.Preferences.importPreferences(
at (a line in my code that calls Preferences.importPreferences(myinputstream)


Now, on top of the fact that this problem doesn't occur on any browser in Windows, what's weirder still is that the .xml file referred to by myinputstream doesn't have the line:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

anywhere in it at all!

It actually starts with:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE preferences SYSTEM ''>

<preferences EXTERNAL_XML_VERSION="1.0">
<root type="user">
... etc

That 4.01 transitional stuff is in the web-page source itself . . which my applet is NOT trying to read!

Is there some sort of known issue with Java Plugin or the JRE on Mac OS 10.3.9? Is there a workaround?

Thanks in advance...

EDIT: I seem to have gotten a similar error using WinXP, with any browser. Same line, though, Preferences.importPreferences(myInputStream)

Anyone ever see something like this?
[ December 15, 2006: Message edited by: Joe Vahabzadeh ]
I agree. Here's the link:
subject: Preferences API and Mac (maybe XP also?!) OS, oddity/issue?
It's not a secret anymore!