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 Junit compile problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Junit compile problem" Watch "Junit compile problem" New topic

Junit compile problem

alpha philips

Joined: Oct 08, 2004
Posts: 2
I set up Junit in d:\Junit, and set classpath to d:\Junit\junit.jar;d:\Junit.
then I run the following instruction:
java junit.swingui.TestRunner junit.samples.AllTests, a swing ui appears but companies with an error message:
Exception in thread "main" java.lang.NoClassDefFoundError: junit.samples.AllTests (wrong name:/Junit/samples/AllTests).......
Could anyone help me?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Looks like a case mismatch in the package name - your command line has "junit" and the class has "Junit". Try upper case J in your command line. I guess the JVM found the class file with case-insensitive search but failed a case sensitive match on the classname inside the file.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
The problem is a little more than that. Your installation directory is D:\Junit but should be D:\junit. Remember that Java is case-sensitive, even if your operating system is not. This means that you need to be very careful when naming files and directories.



Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: Junit compile problem
It's not a secret anymore!