Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Unsupported class version error

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Thank you for any help!!
Karen.
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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" 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.
 
Karen Nelson
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
-Karen.
 
She'll be back. I'm just gonna wait here. With this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic