Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes UnsupportedClassVersion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "UnsupportedClassVersion" Watch "UnsupportedClassVersion" New topic


Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I'm getting one of these fool errors while running Cobertura through ANT. I think it means something in an older version of ANT is trying to load one of my classes in a newer version. Is that right? Maybe I need to figure out how to update ANT within WSAD?

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14428

This error means that you are trying to load a class with an older version of Java that was compiled with a newer version. If I remember correctly, the class version numbers for the last few Java releases are as follows:

Java 1.3: 47.0
Java 1.4: 48.0
Java 5.0: 49.0
Java 6.0: 50.0

Your specific error message means that you have a class file that is compiled on JDK 1.4, and you are trying to run it on Java 1.3 or older.

It is possible to compile class files that are compatible with older versions of Java by specifying the "-target" switch on the command line, but note that this does not solve the problem completely; if you use classes, interfaces or methods in the standard API that are new to Java 1.4, you will get a ClassNotFoundException or NoSuchMethodException during runtime.

The best solution is to compile your source code with the JDK version that matches the target Java runtime version.

JDK 1.3 is still available from the Sun website, but note it has gone EOL (End of Life) since December 2006, so it's time you upgrade to a newer version...

*edit*: Oh, I see that JDK 1.3 on that page is only for Solaris. I don't know if it's still available for other OS'es. But you are maybe using IBM's JDK instead of Sun's - have a look on IBM's website.
[ November 01, 2007: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
bart zagers
Ranch Hand

Joined: Feb 05, 2003
Posts: 234
Just for completeness, there is still the Sun Archive.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Ah, I did just go to the effort of making WSAD use 1.4 when I start things in the IDE. I wonder how to make it use 1.4 from ANT. Something to google tomorrow. Thanks for the tip!
I agree. Here's the link:
subject: UnsupportedClassVersion