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 NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic
Author

NoClassDefFoundError

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i'm using eclipse3.2, java5, ant1.6.5 and junit4
having everything in place, if i run my *AllTests* class FROM eclipse, i get a green bar
now i'm trying (with no success) creating an ant task to run those tests:
here's my ant build file:
when i run ant junit4, i get a long stacktrace basically stating:
java.lang.NoClassDefFoundError: org/hibernate/Session
java.lang.NoClassDefFoundError: com/mockobjects/dynamic/Mock

but as i said before, those jars are in place, application compiles and runs successfully and tests from eclipse also run pretty well

what am i doing wrong?
note: i tried from command line but got the very same errors...


java amateur
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
as to ant errors, i got it: just added *classpathref="libraries"* to
<java classname="org.junit.runner.JUnitCore" fork="yes">
but i'm still stuck with command line; i guess this should be in java general forum from now on
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

If you get "class not found" running JUnit from the Eclipse Ant task, select the Ant dialog ("run as/ant build...". then add the missing libraries to its classpath.


Customer surveys are for companies who didn't pay proper attention to begin with.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
thanks, Tim
that's what i did when i added *classpathref="libraries* to junti4 task
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefFoundError