aspose file tools*
The moose likes Testing and the fly likes while running junit it is throwing java.lang.Unsupported Class Version Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "while running junit it is throwing java.lang.Unsupported Class Version Error" Watch "while running junit it is throwing java.lang.Unsupported Class Version Error" New topic
Author

while running junit it is throwing java.lang.Unsupported Class Version Error

sai prasanna
Ranch Hand

Joined: May 02, 2005
Posts: 167
hi
when iam running junit as

java org.junit.runner.JUnitCore org.junit.tests.AllTests

it is throwing the following exception.
i had set the classpath as

C:\junit4.1\junit-4.1.jar;.;

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/junit/runner/JUnitCore (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)

how to run the junit need help

thanks in advance
saiprasanna
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
JUnit 4 needs Java 5 to run. You are trying to run it under an earlier Java version.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
sai prasanna
Ranch Hand

Joined: May 02, 2005
Posts: 167
Thanks Preuss iam using j2sdk 1.4.2
regards
saiprasanna
sai prasanna
Ranch Hand

Joined: May 02, 2005
Posts: 167
hi
i have another dought that is JUnit 4.1 providing any other compatable files to run on j2sdk 1.4.2

thanks in advance
saiprasanna
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Originally posted by sai prasanna:
hi
i have another dought that is JUnit 4.1 providing any other compatable files to run on j2sdk 1.4.2

thanks in advance
saiprasanna

No. JUnit 4 does not provide a version for Java 1.4. It heavily relies on some Jave 5 features including annotations.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

I now see Ilja answered already in your other thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: while running junit it is throwing java.lang.Unsupported Class Version Error