• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

eclipse and and junit

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I've been googling for ages and am still stuck, so maybe someone here could help me out. For anyone who uses ANT, Junit and eclipse together I guess you know what my problem is and can help me. I just can't get these three technologies to play nice. I have followed this sites tutorial down to a tee http://dsd.lbl.gov/~ksb/Scratch/jajucc_hw.html and got to the stage where junit is introduced, I've tried adding junit.jar to ant/lib and the alternate method also but still no joy. Here's the output I get:


I need to use these for a college project. Also I have restricted permissions on the college machines and won't be able to delete or add to eclipse directories. Can anyone help me. Thanks.
bill
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this line

java.lang.ClassNotFoundException: hello.TestHello


states java cant find TestHello class
does TestHello lies inside a package named hello?
 
billo bailey
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
TestHello is in the hello package.
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

TestHello is in the hello package.



Then the "hello" package is not found in the CLASSPATH.
 
billo bailey
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think that is the problem, I think its an issue with ANT run from eclipse ( in fact I know it is) I was hoping someone could tell me how to workaround it. As the workarounds I've seen haven't worked for me. I'm using eclipse3.2 and ANT1.6.1.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no benefit in modifying Eclipse's directories when you're running tests from Ant. Just pretend that Eclipse doesn't even exist. That gives you one less thing to worry about.

It's common practice when setting up a test project to have a separate source and output class tree from the actual application code. I even go so far as to set things up where I can physically rip out the test subsystem from the directory tree and/or Ant script and the app code won't care, but I can be extreme sometimes.

So in a case like this, the Junit test needs to find:

1. The Junit Ant task (in Ant's extras jar)
2. Junit.jar itself
3. The app's classes
4. The test classes.

Actually, Ant needs to find the Junit Ant task. It doesn't need to be locateable by the Junit test itself. There's really 2 different classpaths, one used by Ant and the other by the Ant task (junit).
 
billo bailey
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help, finally its working.
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Care to share with the rest of us of how you got it to work ?

Originally posted by billo bailey:
Thanks for the help, finally its working.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic