File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Starting JUnit - Testcenter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Starting JUnit - Testcenter" Watch "Starting JUnit - Testcenter" New topic

Starting JUnit - Testcenter

Thomas Markl
Ranch Hand

Joined: Mar 08, 2001
Posts: 192
Hello, I downloaded JUnit from and want to start it. I added it to the class path:

set CLASSPATH=.;c:\Java\SCP2Certification\junit3\junit.jar
Below are the installation steps for installing JUnit:
1. unzip the file
2. add junit.jar to the CLASSPATH. For example: set classpath=%classpath%;INSTALL_DIR\junit3\junit.jar
3. test the installation by using either the batch or the graphical TestRunner tool to run the tests that come with this release. All the tests should pass OK.
Notice: that the tests are not contained in the junit.jar but in the installation directory directly. Therefore make sure that the installation directory is on the class path
 for the batch TestRunner type:
java junit.textui.TestRunner junit.samples.AllTests
 for the graphical TestRunner type:
java junit.awtui.TestRunner junit.samples.AllTests
 for the Swing based graphical TestRunner type:
java junit.swingui.TestRunner junit.samples.AllTests
Important: don't install the junit.jar into the extension directory of your JDK installation. If you do so the test class on the files system will not be found.
Junit is installed on path c:\Java\SCP2Certification\junit3.8.1\junit3.8.1\junit.jar and my SDK1.4 is installed on c:\Java\SDK1.4
So junit is not installed as extention of SDK1.4.
When I start programm with java junit.textui.TestRunner junit.samples.AllTests
I get:
java junit.awtui.TestRunner junit.samples.AllTests
java.lang.NoClassDefFoundError: junit/awtui/TestRunner
Exception in thread "main"
Thomas Markl
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
In your post, your classpath setting doesn't match the location where the JUnit jar file is.
set CLASSPATH=.;c:\Java\SCP2Certification\junit3\junit.jar

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Starting JUnit - Testcenter
It's not a secret anymore!