This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Question on java.lang.UnsupportedClassVersionError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Question on java.lang.UnsupportedClassVersionError" Watch "Question on java.lang.UnsupportedClassVersionError" New topic
Author

Question on java.lang.UnsupportedClassVersionError

Mark Curlette
Ranch Hand

Joined: May 26, 2011
Posts: 46

Hello,

I am struggling with the java.lang.UnsupportedClassVersionError error that I received from running my java program in IBM Websphere Rational Developer Edition version 7 and Websphere Application Server v7. I try to understand what does the error meant; so if you have any clue about what does the error mean, please let me know. I wonder if these errors related to the WAS or JRE given the fact that I am running on WAS 7 , RAD 7.5, and JRE v6 . Hope it help to shed some lights on figuring out what the error is.

The error is as follow :

java.lang.UnsupportedClassVersionError: org/eclipse/emf/ecore/resource/Resource$Factory$Registry (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:810)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:147)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:475)
at java.net.URLClassLoader.access$500(URLClassLoader.java:109)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:848)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java:389)
at java.net.URLClassLoader.findClass(URLClassLoader.java:371)
at java.lang.ClassLoader.loadClass(ClassLoader.java:572)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:442)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)



Thanks in advance,

Minh
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11167
    
  16

I believe it means you have compiled with a newer version of java than you are running it on. So you may have compiled with Java 7, but your JRE is java 6.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Mark Curlette
Ranch Hand

Joined: May 26, 2011
Posts: 46

Thank you so much Fred,
Yes, you are exactly right. I jjust checked and it turned out to be exactly what you said.
Since I am runiing on WAS 7 meaning I am compiling with Java 7 , right ? , and I check my java build path and I see Web Sphere V6 JRE.
Since I am new, please correct me if I am wrong. So based on what you were mentioning that I were compiling my program on WAS 7 but I ran it in v6 JRE ; therefore the error was caused by compiling on Java version 7 but running it onn JRE v6.

Thanks for your help, I am now understand it. One more question if you don't mind, since I am running on the JRE V6 , and compile my program on version 7 and now i want to get rid of the error then what should i do?

Please correect me if i am wrong. Could i import the Web Sphere V7 JRE into my java build path library in order to make it compatible with my WAS v7 ?

If it is the case, how could i import the Web Sphere V7 JRE into my java build path?

Thanks again for all of your help.

Minh
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

The easiest solution is to use JDK 6 instead of JDK 7, if your program has to run on a Java 6 JRE.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

The 49.0 version indicates the class is compiled with Java 5.0 (Java 7 is 51.0), so you're not using Java 6 but Java 1.4 or below. Perhaps some older JRE nested itself in the PATH variable before your Java 6 JRE. Oracle database products are notorious for doing this.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on java.lang.UnsupportedClassVersionError
 
Similar Threads
Problems compiling servlet
JBOSS PROBBLEM...PLEASE HELP ME!!!
JBOSS PROBBLEM...PLEASE HELP ME!!!
Exception: java.lang.ClassVersionError:
XMLbeans giving problem with WebSphere