jQuery in Action, 3rd edition
The moose likes Applets and the fly likes Unsupported class version error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Unsupported class version error" Watch "Unsupported class version error" New topic

Unsupported class version error

Karen Nelson
Ranch Hand

Joined: Aug 19, 2005
Posts: 57
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.

Thank you for any help!!
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

"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.

[Jess in Action][AskingGoodQuestions]
Karen Nelson
Ranch Hand

Joined: Aug 19, 2005
Posts: 57
Thank you, upgrading did solve the problem. Now I just have to decide whether to fix the classes to work in 1.4...
I agree. Here's the link: http://aspose.com/file-tools
subject: Unsupported class version error
It's not a secret anymore!