Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

NoClassDefFoundError

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Saloon Keeper
Posts: 22279
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, Tim
that's what i did when i added *classpathref="libraries* to junti4 task
 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic