aspose file tools
The moose likes Beginning Java and the fly likes Getting JUnit to run with Compiled Tests Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Getting JUnit to run with Compiled Tests" Watch "Getting JUnit to run with Compiled Tests" New topic
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
    
  13

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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Getting JUnit to run with Compiled Tests
 
Similar Threads
ANT and JUnit fork problem
problem installing junit
Novie JUNIT user need helps - NoClassDefFoundError + bash + windows
problem installing junit
Problem with Package execution