Configuring Java for JUnit 3.8.1 in the bash Shell
Thanks to Aaron Thompson for his assistance in preparing these instructions.
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin BASH_ENV=$HOME/.bashrc USERNAME="" export USERNAME BASH_ENV PATH
# .bashrc # User specific aliases and functions # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi if [ -f /etc/bash.bashrc ]; then . /etc/bash.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin BASH_ENV=$HOME/.bashrc USERNAME="" CLASSPATH=$HOME/junit3.8.1/junit.jar:.; export USERNAME BASH_ENV PATH CLASSPATH
This tells your Java tools to look for classes first in the directory $HOME/junit3.8.1/junit.jar and then in the current working directory. If you have placed your junit3.8.1/ directory somewhere other than your home directory, add the corresponding directories to this path expression between $HOME/ and junit3.8.1/junit.jar.
You should now be able to run JUnit from any directory. If you want to run the tests provided with the JUnit package, then you need to either