wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes UnsupportedClassVersionError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "UnsupportedClassVersionError" Watch "UnsupportedClassVersionError" New topic
Author

UnsupportedClassVersionError

Sunny Gibbony
Ranch Hand

Joined: May 14, 2008
Posts: 39
I am getting this error when I run my master.bat file. I've checked the jdk class path and it looks fine. Has anyone seen this before?


run specialties load .bat BEGIN...
Exception in thread "main" java.lang.UnsupportedClassVersionError: example/SpecialLoader (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
run specialties load .bat COMPLETED

run zone inspection load .bat BEGIN...
Exception in thread "main" java.lang.UnsupportedClassVersionError: example/InspectionLoader (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
run zone inspection load .bat COMPLETED

run all .bat files COMPLETED
Press 'Enter' to exit...
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 686
Looks like the class file was compiled with a younger version of java than you are using to execute it. Check that the java program is as young as the javac program used to compile it.
Vilmantas Baranauskas
Ranch Hand

Joined: Dec 20, 2006
Posts: 89
When compiling a java class, version number is included in each *.class file:

major version: 48 = Java SE 1.4.2
major version: 49 = Java SE 5
major version: 50 = Java SE 6

Your classes have been compiled on java 5, and you try to run them on Java <=1.4.


Author of <a href="http://www.newsinjector.com" target="_blank" rel="nofollow">NewsInjector</a>
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14150
    
  18

Try searching in the forums or with Google for "UnsupportedClassVersionError" - this has been discussed before.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Sunny Gibbony
Ranch Hand

Joined: May 14, 2008
Posts: 39
Yes there are alot of perivous posts about this. It looks like maybe the JVM is older than the compiler. What is the command/process to check the version of the JVM or JRE?
Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

Originally posted by Ashlon Hill:
What is the command/process to check the version of the JVM or JRE?


To know version of your JDK you can use
%>javac -version

To know version number of your JRE you can use
%>java -version
in your Command Prompt(Terminal)
[ July 10, 2008: Message edited by: Balasubramanian Chandrasekaran ]
Sunny Gibbony
Ranch Hand

Joined: May 14, 2008
Posts: 39
Yes that is correct.

it was trying to use java 1.3 instead of java 1.5!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UnsupportedClassVersionError