| Author |
Getting JUnit to run with Compiled Tests
|
Phil Jenkins
Greenhorn
Joined: Oct 14, 2006
Posts: 2
|
|
I am a JAVA beginner and I have Java 5.0 loaded in the following directory: c:\javaclass\jdk I also have junit 3.8.2 loaded in c:\javaclass\junit3.8.2 I try to execute a test (HelloTest) from the directory that has my compiled test in it using junit3.8.2 by inputting the following command: C:\javaclass\hellotest>java -cp c:\javaclass\junit3.8.2\junit.jar;.junit.swingui.TestRunner HelloTest I get the following message: Exception in thread "main" java.lang.NoClassDefFoundError: HelloTest Any Ideas?  [ October 14, 2006: Message edited by: Phil Jenkins ]
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24054
|
|
Hi Phil, Welcome to JavaRanch! You've accidentally left out the space between the end of the classpath (...;.) and the beginning of the name of the class to run (junit.swingui.TestRunner), leaving the JVM to decide that what you intended as the argument to the test runner (HelloTest) is the name of the class to run. Then the JVM can't find it, because the classpath doesn't have the "." entry you intended it to have! So add a space after ";." and before "junit.swingui", and everything should work just fine.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Phil Jenkins
Greenhorn
Joined: Oct 14, 2006
Posts: 2
|
|
|
Thank You -- The JUnit add-on works fine now
|
 |
 |
|
|
subject: Getting JUnit to run with Compiled Tests
|
|
|