Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set up JUnit on Mac OS X?

 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I set up JUnit on MAC OS X. When I followed the instructions that I found, I always get:

Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUnitCore

How can I do that step by step?

Thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have to do anything at all to set it up; you just have to include the jar file on the classpath whenever you compile or run your tests. Exactly how to do this depends on how you're working: at the command line, with Ant, in Eclipse, in XCode, in NetBeans... there are many possibilities!
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest Friedman-Hill wrote:You don't have to do anything at all to set it up; you just have to include the jar file on the classpath whenever you compile or run your tests. Exactly how to do this depends on how you're working: at the command line, with Ant, in Eclipse, in XCode, in NetBeans... there are many possibilities!


How can I do it on the command line?

Can you please provide me with instructions since I'm new to MAC OS X?

Thanks.
 
Vince Stone
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abder-Rahman Ali wrote:
Ernest Friedman-Hill wrote:You don't have to do anything at all to set it up; you just have to include the jar file on the classpath whenever you compile or run your tests. Exactly how to do this depends on how you're working: at the command line, with Ant, in Eclipse, in XCode, in NetBeans... there are many possibilities!


How can I do it on the command line?

Can you please provide me with instructions since I'm new to MAC OS X?

Thanks.


Did you ever figure out how to do it on the command line/terminal? I am trying to figure this out. Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any tutorial on compiling from the command line will cover this.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Running from the command line requires one extra piece of ingo - the name of tne runner to use. See the Junit faq
 
Nikhil Das Nomula
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think its been ages since this has been posted. Anyways the issue might be that you need to check your classpath. I think you are using a command like




Instead if you can explicitly specify the classpath as shown below then it solves the NoClassDefFoundError exception.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic