Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Testing and the fly likes How to set up JUnit on Mac OS X? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "How to set up JUnit on Mac OS X?" Watch "How to set up JUnit on Mac OS X?" New topic
Author

How to set up JUnit on Mac OS X?

Abder-Rahman Ali
Ranch Hand

Joined: May 22, 2008
Posts: 138
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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!


[Jess in Action][AskingGoodQuestions]
Abder-Rahman Ali
Ranch Hand

Joined: May 22, 2008
Posts: 138
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

Joined: Oct 01, 2011
Posts: 7
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

Joined: Jan 10, 2002
Posts: 61457
    
  67

Any tutorial on compiling from the command line will cover this.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30795
    
157

Running from the command line requires one extra piece of ingo - the name of tne runner to use. See the Junit faq


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Nikhil Das Nomula
Greenhorn

Joined: Jun 10, 2011
Posts: 26
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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set up JUnit on Mac OS X?