NoClassDefFoundError when trying to test JUnit
March 20th, 2009
Applies to:
NA
Description:
Occurs when trying to test Junit
Cause:
Most likely your CLASSPATH doesn’t include the JUnit installation directory.
Applies to:
NA
Description:
Occurs when trying to test Junit
Cause:
Most likely your CLASSPATH doesn’t include the JUnit installation directory.
To run your JUnit tests, you’ll need the following elemements in your CLASSPATH:
* JUnit class files
* Your class files, including your JUnit test classes
* Libraries your class files depend on
If attempting to run your tests results in a NoClassDefFoundError, then something is missing from your CLASSPATH.
Windows Example:
set CLASSPATH=%JUNIT_HOME%\junit.jar;c:\myproject\classes;c:\myproject\lib\something.jar
Unix (bash) Example:
export CLASSPATH=$JUNIT_HOME/junit.jar:/myproject/classes:/myproject/lib/something.jar