954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Can not test the installation of junit..

hi im janaka


i tried to do the unit testing with JBuilder.

download and install Junit
set the class path.

but according to the readme file, i was unable to test my installation.
these are that instructions.

addjunit-4.1.jar to the CLASSPATH. For example: set classpath=%classpath%;INSTALL_DIR\junit-4.1.jar;INSTALL_DIR
test the installation by running java org.junit.runner.JUnitCore org.junit.tests.AllTests.

the second one can not done.

if anyone can help me


thanks you......

rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

What error did you get?

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

when run use run command on command prompt in windows

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

the following error will give

Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUni
tCore

rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

Sounds like it may be a classpath (probably is) a classpath problem. Please state exactly where you placed the jar and post your complete classpath. It may also be that this package also requires another package that either don't have installed, or is not contained on your class path. Check the documentation and your install for this possibility.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

junit was install into C:\junit4.1 directry and set the class path as "C:\junit4.1\junit-4.1.jar" . but still unable to run the test command

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


still it will give the error as

Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUni
tCore

rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

im janaka priyadarshana,


when im going to create a test class with "JBuilder" it did not allow to import the junit pacage.
it was indicated an error for the follwing line.

import junit.framework.*;


if anyone know the reason please informe me.


thank you......

rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

And ClassNotFound or NoClassDefFound is always a Classpath problem or it simply does not exist. Check that your JBuilder configuration also contains this jar as a library or external jar.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

I'm getting the same error message using the command prompt. I'm not using jbuider. I am using java 1.5 and junit 1.4. My paths seem to be OK I get the correct java version, but I get the same error--
C:\junit4.1>java org.junit.runner.JUnitCore org.junit.tests.AllTests
Exception in thread "main" java.lang.NoClassDefFoundError:org/junit/runner/JUnitCore

If anybody else has any ideas let me know.

DrGreg
Newbie Poster
1 post since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

And like I said, it is a CLASSPATH (not PATH) problem.
Use "java -cp .: Classname"

On windows you may need to replace ".:" with ".;"

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

oh......i have got success in this problem with windows machien

first set the classpath as follow

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

then please remember to restart your machiene

most probably then you will be able to solve the problem

rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

junit was install into C:\junit4.1 directry and set the class path as "C:\junit4.1\junit-4.1.jar" . but still unable to run the test command

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

still it will give the error as

Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUni
tCore


can u help me..am karthik....:!: ..send ur reply to plz

karthiksk
Newbie Poster
6 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

am working wth eclipse platform...i was supposed to do the test using junit...how and wher should i writee the test cases..can u plz help me...send ur reply to

how do i test them for javafiles.??????

karthiksk
Newbie Poster
6 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

am working wth eclipse platform...i was supposed to do the test using junit...how and wher should i writee the test cases..can u plz help me...send ur reply to
how do i test them for javafiles.??????

karthiksk
Newbie Poster
6 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

In which folder ,do we need to save our tests?
Whether in Junit4.1 or in JDK 1.5\bin?
can u briefly explain how and where to write the java program and its test file with one small example

dinesh13284
Newbie Poster
1 post since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

doesn't matter. As long as junit.jar and the test classes both are on your classpath they'll be found.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

I am getting
Error: java.lang.ClassCastException : class junit.tests.AllTests

Is something wrong with classpath settings?

arch1
Newbie Poster
3 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

why should we help a thread hijacker who resurrects age old threads rather than starting its own?

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

I am also getting the same errorPlease help!!!

C:\junit4.5\junit4.5>java org.junit.runner.JUnitCore org.junit.tests.AllTests
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUnitCore

My classpath is :

C:\junit4.5\junit4.5>path

PATH=C:\Program Files\Java\jdk1.5.0_18\bin;C:\oracle\product\10.1.0\db_1\bin;C:\oracle\product\10.1.0\db_1\jre\jre1.6.0_12\bin\client;C:\oracle\product\10.1.0\db_1\jre\jre1.6.0_12\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program Files\Microsoft SQL Server\\Tools\Binn\;C:\Program Files\MicrosoftSQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\
Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\Java\jre1.6.0_12\bin\client;C:\junit4.5\junit4.5\junit-4.5.jar

Please help Urgently!!

Thanks!

sadz2k9
Newbie Poster
1 post since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You