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