I've done a ton of testing on this issue. It appears to be a MASSIVE bug in either firefox or the java plugin for firefox. My guess is it's firefox, but many people report this bug as a java plugin issue. This affects all Processing applets that use loadImage or XMLElement with a URL. It looked like the problem was firefox (or the java plugin) converts the domain name from loadImage or XMLElement to an IP address as the exception would indicate. And then it doesn't realize that the domain name and IP point to the same place so it throws an exception as it should otherwise. I can't make my website have an IP address as its URL, so I was really discouraged thinking I couldn't use Processing for my web application
.
But there's an easy workaround I found for loading images. Simply use the IP address of the server where the applet came from (and images will come from). The fact that this works leads me to believe the issue is the other way around, firefox converts your website domain to an IP and gets confused when loadImage tries a domain name. But XMLElement doesn't work either way
. When trying to instantiate an XMLELement with new XMLElement(this, "http://<my_ip>/tree.xml"), I now get the following exception:
Couldn't create a reader for http://<my_ip>/tree.xml
Exception in thread "Animation Thread" java.lang.NullPointerException
at java.io.Reader.<init>(Unknown Source)
Anybody have any ideas on how I can get XMLElement to work in an applet?
Processing has 2 additional issues when exporting applets I realized:
1) the html for visitors without java leads you to an old link with only jre 1.4 (and lower versions). But installing it breaks your Processing app as Processing requires jre 1.5 I guess.
2) the html ends up loading 2 copies of your applet in firefox. I guess firefox understands both <object>'s.
So here's what I found out in regards to Processing applets:
1) they work on all browsers except firefox
2) they work on firefox if you use an IP for the URL of the website
3) they work on firefox on mac and windows vista
4) they DON'T work if you get resources through a URL with domain name on Win2003 server and WinXP
5) the OS issue above may be a coincidence in my testing and really it's an issue of the firefox java plugin version you use
6) you can work around loadImages by using an IP in the URL
7) I wasn't able to get XMLElement to work in firefox on WinXP
To the poster above, what OS and Java version are you using?