Description
If the java "ext" directory is specified on the command line, JUnit is unable to find the unit test classes. Whereas, if "classpath" is used, everything is fine. When tests depend on a number of 3rd party libraries, the "ext" directory approach is far preferable.
For example:
java -classpath /home/cowan/src/atst/lib/java/classes
-Djava.ext.dirs=/home/cowan/src/atst/lib/java/ext org.junit.runner.JUnitCore atst.cs.test.TestAll
results in:
JUnit version 4.7
Could not find class: atst.cs.test.TestAll
The strange thing is that if the verbose flag is used, Java even logs that it successfully loaded the TestAll class from the appropriate directory before later displaying the error.
If the command line is modified to:
java -classpath
/home/cowan/src/atst/lib/java/classes:/home/cowan/src/atst/lib/java/ext/junit.jar
org.junit.runner.JUnitCore atst.cs.test.TestAll
everything works as expected.
-Djava.ext.dirs seems to be causing classpath/classloader issues.