File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with installing JUnit on Red Hat