This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Problem with installing JUnit on Red Hat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Problem with installing JUnit on Red Hat" Watch "Problem with installing JUnit on Red Hat" New topic
Author

Problem with installing JUnit on Red Hat

Unnsse Khan
Ranch Hand

Joined: Nov 12, 2001
Posts: 511
Hello...
I have been having trouble installing JUnit 3.8.1 on my Linux distribution, Red Hat 7.3, in particular.
Here's what I did:
1. I logged into Red Hat 7.3 as root
2. I downloaded JUnit3.1.8 frpm http://www.junit.org/index.htm
3. I followed the instructions by unzipping it, and I unzipped it at:
/usr/local/junit3.8.1
the junit.jar was located at
/usr/local/junit3.8.1/junit.jar
The instructions told me to append/add the junit3.8.1 directory and the junit.jar file to my CLASSPATH, so I did this:
cd /root
vim .bash_profile
and added accordingly (this is what my .bash_profile looks like):
------------------------------------------------------
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
JUNIT_HOME=$JUNIT_HOME:/usr/local/junit3.8.1/
JAVA_HOME=$JAVA_HOME:/usr/local/java/j2sdk1.4.0_01
J2EE_HOME=$J2EE_HOME:/usr/local/j2sdkee1.3.1
CLASSPATH=$CLASSPATH:.$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar:$J2EE_HOME/lib/j2ee.jar:$JUNIT_HOME/junit.jar:$JUNIT
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$J2EE_HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME="root"
export USERNAME BASH_ENV PATH JAVA_HOME CLASSPATH J2EE_HOME JUNIT_HOME
--------------------------------------------------
And when I try to test it by typing in the following on the command line:
java junit.textui.TestRunner junit.samples.AllTests
It printed:
Exception in thread "main" java.lang.NoClassDefFoundError: junit/textui/TestRunner
Can anyone help me with this problem?
-Unnsse
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Unnsse Khan:
# User specific environment and startup programs
JUNIT_HOME=$JUNIT_HOME:/usr/local/junit3.8.1/
JAVA_HOME=$JAVA_HOME:/usr/local/java/j2sdk1.4.0_01
J2EE_HOME=$J2EE_HOME:/usr/local/j2sdkee1.3.1

I am not very familiar with unix environments, but I think those should read
# User specific environment and startup programs
JUNIT_HOME=/usr/local/junit3.8.1/
JAVA_HOME=/usr/local/java/j2sdk1.4.0_01
J2EE_HOME=/usr/local/j2sdkee1.3.1
[ December 04, 2002: Message edited by: Ilja Preuss ]

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Brian McCallister
Greenhorn

Joined: Dec 03, 2002
Posts: 19
Hmm, a couple recomendations:
1) Do not set up classpaths in your environment. Setting JAVA_HOME, ANT_HOME, JUNIT_HOME are okay, but setting up the actual CLASSPATH will bring you grief down the line when you think you are running against one library, but you are really running against a different version of it that was configured in your system classpath.
2) Ilja is exactly right, JAVA_HOME, ANT_HOME, JUNIT_HOME, JBOSS_HOME and those really shouldn't even be more than a single path. These do not represent search paths, they are absolute paths to these direcotries - so you don't want /path/one:/path/two you just want the path you wish to use.
-Brian
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Moving to the Jakarta Forum (Open Source Projects).


"JavaRanch, where the deer and the Certified play" - David O'Meara
Unnsse Khan
Ranch Hand

Joined: Nov 12, 2001
Posts: 511
I fixed the .bash_profile like Ilja suggested, typing in:
java junit.textui.TestRunner junit.samples.AllTests
still doesn't work on Linux... Can anyone help me with this?
-Unnsse
 
jQuery in Action, 2nd edition
 
subject: Problem with installing JUnit on Red Hat
 
Similar Threads
confuse on how to set the java_home classpath correctly
Having some problem with redhat installation
MySQL Driver, Help!
JUnit 3.8.1 on Red Hat 7.3
"root" vs. "user defined user"