Hi, I have written an applet that works fine when I invoke it through netscape on my laptop. However, when I try to do it on anyone else's computer, I get an Unsupported Class Version error.
I have tried to set up my code as suggested in Headfirst Java (i.e., in a package called com\rephunk\... in a jar). There are also several classes I wrote that I use in multiple applications, and they are in a separate jar, but same package structure (i.e., also com\rephunk\...). The applet tag currently reads
I have also tried using code="com/rephunk/MortApplet.class" Both work fine on my computer.
The jar files are in the same directory with the html page calling the applet.
"Unsupported Class Version" means the classes were compiled for a newer version of Java than the one you're trying to run them on. For example, if you've got JDK 1.5 on your machine, but your friend has only the 1.4 plugin, you would see this error. If you compile with
javac "-source 1.4" Foo.java
That "-source 1.4" will ensure that the classes will work on your friend's computer. Of course, if you used any Java 5 features, then your code won't compile. If you use those new features, then your code only runs on Java 5 runtimes.
You can support even older Java versions using the "-target" switch to the compiler.