File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Putting my Test*.java files in another directory and getting them to run!! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "Putting my Test*.java files in another directory and getting them to run!!" Watch "Putting my Test*.java files in another directory and getting them to run!!" New topic
Author

Putting my Test*.java files in another directory and getting them to run!!

Claudio Illanes
Greenhorn

Joined: Apr 28, 2004
Posts: 3
Hi, I am just trying out Junit and am relatively new to Java development. My problem is getting the class to be recognized and avoiding the ClassNotFoundException. My root directory contains a /source directory which creates a jar. The root directory also contains a test directory:
/source/com....
/test/source/com....
/test/classes/com....
I keep getting ClassNotFoundException when trying to make a call to:
<junit ... >
<test "com..... .class">
</junit>
What would be a quick fix for this problem keeping the above directory structure??? Even without keeping the above directory structure???
Any help would be greatly appreciated!
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9001
I think the easiest way is to compile both "source" and "test" classes to the same destination. Otherwise, you need to be sure that classpaths to both destinations are in the classpath for the junit target.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
 
subject: Putting my Test*.java files in another directory and getting them to run!!
 
Threads others viewed
[junit] java.lang.ClassNotFoundException: UserActivityTest
NoClassDefFoundError: junit.framework.Test in Maven
Package Problem - Help Please
Package does not exist::Pls. help me out
linking webapp with ejb in ear
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com