java.lang.UnsupportedClassVersionError:

Hello EveryBody

I am doing an application uising servlet in Eclipse editor.I also using Junit for testing the individual module.When i am testing a module it shows me the following error.

java.lang.UnsupportedClassVersionError: junit/framework/TestListener (Unsupported major.minor version 49.0)

at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:539)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)

at java.net.URLClassLoader.access$100(URLClassLoader.java:55)

at java.net.URLClassLoader$1.run(URLClassLoader.java:194)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:187)

at java.lang.ClassLoader.loadClass(ClassLoader.java:289)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)

at java.lang.ClassLoader.loadClass(ClassLoader.java:235)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:539)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)

at java.net.URLClassLoader.access$100(URLClassLoader.java:55)

at java.net.URLClassLoader$1.run(URLClassLoader.java:194)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:187)

at java.lang.ClassLoader.loadClass(ClassLoader.java:289)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)

at java.lang.ClassLoader.loadClass(ClassLoader.java:235)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

Exception in thread "main"

regards

srikant

[1999 byte] By [srikanta] at [2007-10-2 20:10:12]
# 1
plz suggest me how to solve the abobe problem
srikanta at 2007-7-13 22:50:46 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 2
plz suggest me how to solve the above problem
srikanta at 2007-7-13 22:50:46 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 3
Yes, this is a common error caused by mixing Java versions. Please search for "unsupported major minor", there are more than 200 threads about it.
ChuckBinga at 2007-7-13 22:50:46 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 4
You are running a JUnit compiled for 1.5 (presumably JUnit 4) on a 1.4 or older JVM.Either run your tests in a 1.5 JVM, or stick with good old JUnit 3.8.1.
Lokoa at 2007-7-13 22:50:46 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 5
thanks for ur replay junit testing is working perfectly when i am testing core java applications.But it gives unsupportedClassversion when i am trying to run junit on servlets.Regardssrikant
srikanta at 2007-7-13 22:50:46 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 6

> junit testing is working perfectly when i am testing

> core java applications.But it gives

> unsupportedClassversion when i am trying to run

> junit on servlets.

Maybe your servlet engine does not use the same JRE as the one you use to run your classical java app. e.g. Tomcat on Windows selects its JRE at install time, so if you installed another JRE afterwards...

jdupreza at 2007-7-13 22:50:46 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 7

The problem you are facing is probably because you are compiling with a version of the JDK that is newer than the version of JDK you are running against.

If you are using eclipse then select the right version of JRE.

In eclipse, Windows --> Peferences --> Installed JREs ,

Here select the updated version.

It should work fine.

karthik9989a at 2007-7-13 22:50:46 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 8
Hi Kartik. I have already solve that problem.Thanks for your replay.my mail address is sriku_kumar@yahoo.co.inThanks and Regards Srikant
srikanta at 2007-7-13 22:50:46 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 9
In addition to modifiing the compiler in your build settings, also make sure your compliance settings are set to 1.4, not 1.5. This fixed the same problem for me in eclipse 3.2.0.Go to Project -> Properties and select 'Java Compiler' to see the settings for these.
javarussella at 2007-7-13 22:50:46 > top of Java-index,Archived Forums,Debugging Tools and Techniques...