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......

What error did you get?

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

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.

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

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......

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.

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.

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

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

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

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 <snipped email> plz

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 <email snipped>

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

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 <email snipped>
how do i test them for javafiles.??????

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

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

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

Is something wrong with classpath settings?

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

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.