Install Junit

J

jimmi1311

Hey anyone

A have a problem with Junit. I have installed it and added it to my
CLASSPATH like this:
C:\junit\; C:\junit\junit-4.1.jar

But when I try to run the test it fail like this:
C:\>java org.junit.runner.JUnitCore org.junit.tests.AllTests
Exception in thread "main" java.lang.NoClassDefFoundError:
org/junit/runner/JUnitCore

I'm running Windows XP.

I have restartet Windows after I have changed the CLASSPATH.

Any help??

Kind regards
Jimmi Wolff
 
S

Simon

jimmi1311 said:
Hey anyone

A have a problem with Junit. I have installed it and added it to my
CLASSPATH like this:
C:\junit\; C:\junit\junit-4.1.jar
^
Try to remove the blank.

Cheers,
Simon
 
J

jimmi1311

Simon skrev:
^
Try to remove the blank.

Cheers,
Simon

It helped, tahanks. But now I get a new problem:

C:\> java org.junit.runner.JUnitCore org.junit.tests.AllTests
Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/junit/run
ner/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)

Can anyone fix that?

Kind regards
Jimmi W.
 
T

Thomas Weidenfeller

jimmi1311 said:
C:\> java org.junit.runner.JUnitCore org.junit.tests.AllTests
Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/junit/run
ner/JUnitCore (Unsupported major.minor version 49.0)

Your JDK and JRE versions don't match or at least JUnit was compiled
with a newer compiler. Use the same releases, or try to compile
everything from scratch with with the -target option (and -source and
-bootclasspath) for your older JRE. The later might fail if your source
code uses newer Java features and APIs.

/Thomas
 
C

Chris Uppal

jimmi1311 said:
Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/junit/run
ner/JUnitCore (Unsupported major.minor version 49.0)

That means that you are attempting to load a class, apparently
org.junit.runner.JUnitCore, which has been compiled by a 1.5 compiler and is
intended to run on a 1.5 JVM, into an older JVM. If you can't, or don't want
to, update your platform, and can't find a version of JUnit compiled for that
platform (presumably 1.4 or 1.3), then you'll have to rebuild JUnit from source
yourself.

-- chris
 
G

Greg R. Broderick

Simon skrev:

It helped, tahanks. But now I get a new problem:

C:\> java org.junit.runner.JUnitCore org.junit.tests.AllTests
Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/junit/run
ner/JUnitCore (Unsupported major.minor version 49.0)

Your version of JUnit was compiled with JDK 1.5.0, and you are trying to run
it with an older version of the JRE.

Solutions:

1. upgrade to JDK 1.5.0 on your development platform

or

2. download an older version of JUnit that does not require Java 1.5
features. JUnit 3.8.x versions will run under JDK/JRE 1.4.

Cheers
GRB

--
---------------------------------------------------------------------
Greg R. Broderick (e-mail address removed)

A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,244
Members
46,838
Latest member
KandiceChi

Latest Threads

Top