I am building fat jar that includes some integration tests that I would like to run from the command line. I would like to be able to do the following:
java -cp myfat.jar org.junit.runner.JUnitCore path.to.MyTest
However, when I do so I get:
Error: Could not find or load main class org.junit.runner.JUnitCore
Now, when I run:
javap -cp myfat.jar org.junit.runner.JUnitCore
I get output that I would expect:
Compiled from "JUnitCore.java"
public class org.junit.runner.JUnitCore {
public org.junit.runner.JUnitCore();
public static void main(java.lang.String...);
...
And my tests run fine when I simply unzip the jar and run something like the following from the directory I unzipped to:
java -cp . org.junit.runner.JUnitCore path.to.MyTest
Why can 'javap' find classes in my jar, but not 'java'? What might I try next to debug this?