Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unsupported class version error

Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
author and iconoclast
Posts: 24203
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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"

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.
Karen Nelson
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, upgrading did solve the problem. Now I just have to decide whether to fix the classes to work in 1.4...
Get me the mayor's office! I need to tell him about this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic