• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting JUnit to run with Compiled Tests  RSS feed

 
Phil Jenkins
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Phil Jenkins
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You -- The JUnit add-on works fine now
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!