JUnit on os x, CLASSPATH incorrect?

A

Angry Moth Town

Hey everyone,

Following instructions I found online, I have downloaded
junit-4.4.jar, and placed it in ~/Library/Java/ on my system running
OS X Leopard.

I created and edited my ~/.profile to read:

export CLASSPATH="~/Library/Java/junit-4.4.jar"

and now I can 'echo $CLASSPATH' and get:
~/Library/Java/junit-4.4.jar

As a test to see if everything is setup correctly, the reference I was
using suggested I run:
java org.junit.runner.JUnitCore org.junit.tests.AllTests

but I receive the error:Exception in thread "main"
java.lang.NoClassDefFoundError: /Users/mothtown/Library/Java/org/junit/
runner/JUnitCore

Any tips on what I'm doing wrong? My source online could be
completely off, but I'm not sure what else to do. Thanks in advance
for any guidance.
 
L

Lionel van den Berg

but I receive the error:Exception in thread "main"
java.lang.NoClassDefFoundError: /Users/mothtown/Library/Java/org/junit/
runner/JUnitCore

Does this path exist?
 
L

Lothar Kimmeringer

Angry said:
As a test to see if everything is setup correctly, the reference I was
using suggested I run:
java org.junit.runner.JUnitCore org.junit.tests.AllTests

Calling with relying on the CLASSPATH-variable is "bad style". Be
on the save side and call it using
java -cp ~/Library/Java/junit-4.4.jar org.junit.runner.JUnitCore org.junit.tests.AllTests

This should work.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,838
Latest member
KandiceChi

Latest Threads

Top