This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

eclipse and and junit

 
billo bailey
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
miguel lisboa
Ranch Hand
Posts: 1281
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TestHello is in the hello package.
 
Craig Jackson
Ranch Hand
Posts: 405
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17620
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help, finally its working.
 
Ken Loh
Ranch Hand
Posts: 190
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic