I just started to play with applets. I normally write code with j2sdk1.4.*. on winXP. Even if I stick to older (=no swing) stuff, I get a BAD MAJOR VERSION NUMBER when I check the applets with MAC OS9 + MR.J. Sometimes, just recompiling the same code on the mac produces a workable applet. Does anybody knows a "trick" to compile "old" code on a modern PC+sdk, so that older browsers+ JRE run the applet, except installing the older jdk's of course?
The Java compiler javac has a "-target" flag: you use it to tell the compiler what version class files it should generate. If for example, you're using j2sdk1.4, but you need your class files to work on 1.3 and above, then use "javac -target 1.3" to compile your classes.
Thank you very much. This helps me on the way! May I request a hint: what target should I use so that "nearly everyone can enjoy the applets (users of win98 FE with MS JRE, MasOS9, users without knowledge of plugins,...) Ichecked the applets with MRJ 2.2 (mac OS9)- so what target that is, I don't know. (It's apparently not mentioned in the docs)
To have everyone with a Java enabled browser able to use your applet without upgrading their browser plugin, you need to compile to 1.1 bytecode and not use JFC (Swing).
1.2 and 1.3 plugins (with Swing) should be available for most any platform. 1.4 plugins for most if not current production platforms since 2001 or so. 1.5 plugins currently only for Win32, Linux and Solaris (and a few 64 bit versions for some Linux and Win32 architectures as well as Solaris). 1.5 plugin for Mac OS/X is currently in closed (I think) beta for inclusion in Apple's NEXT OS version scheduled for (AFAIK) next year.