Applet Notinited Sometimes, Sometimes Not

Fairly experienced java programmer here, but I'm pretty new to applets.

I have created a class that extends JApplet and overrides init(). It works 100% properly when I run it on my computer, or another computer in the house, both running 1.5 update 6 (what it's compiled under). And when I say "run," I don't mean from an IDE, I mean from the web using Firefox and IE. However, if any older JRE is used, the user is presented with a "notinited" error.

Is this a problem with the language, or something I can fix through reprogramming or even recompiling under an older version of the JDK?

Thanks in advance for any and all help!

Scott

[668 byte] By [Kestrel87a] at [2007-10-2 15:01:27]
# 1
Try running the applet using the appletviewer tool.When the applet fails, you should see an icon in the upper left corner of its display area. Right-click this and look at the Java Console output, it has the actual Java error (that the browser is not reporting to you.)
ChuckBinga at 2007-7-13 13:47:39 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

I installed a copy of the 1.4.2_11 JRE to test with, and sure enough, it throws a nice error.

java.lang.UnsupportedClassVersionError: RoseFractal (Unsupported major.minor version 49.0)

at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.defineClass(Unknown Source)

at java.net.URLClassLoader.access$100(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadCode(Unknown Source)

at sun.applet.AppletPanel.createApplet(Unknown Source)

at sun.applet.AppletPanel.runLoader(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

This appears to simply be a compatibility problem. An applet written in 1.5.0_06 doesn't appear to be runnable under 1.4.2.

I have recompiled under 1.4.2, and it now runs fine under both JRE 1.4.2 and 1.5.

It's a shame such a simple applet couldn't be compatible with an older version of Java. I understand upwards compatibility is a tall order, but something as simple as a fractal applet? I didn't use any 1.5 features in its creation (unless you want to get picky and say the class loading, which I have no control over).

Thanks for the help.

Scott

Kestrel87a at 2007-7-13 13:47:39 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

Unless you tell it otherwise, Java assumes that you're using features that require the version that your program is compiled under.

To tell it otherwise (i.e., to tell it to run a program [compiled with 1.5] with an older version) use the -target and/or -source options on the java command. See the java command documentation for the details.

ChuckBinga at 2007-7-13 13:47:40 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...