The class ParserTest
is in the package myproject.tests
and stored in this directory structure:
.
└── myproject
└── tests
└── ParserTest.class
Set the CLASSPATH for the current shell session (no -cp
option, to keep to java call clean):
export CLASSPATH=.:/usr/local/lib/java/junit-4.12.jar:/usr/local/lib/java/hamcrest-core-1.3.jar
Call the JUnit runner and pass the test class as the argument:
java org.junit.runner.JUnitCore myproject/tests/ParserTest
This error gets thrown:
...
1) initializationError(org.junit.runner.JUnitCommandLineParseResult)
java.lang.IllegalArgumentException: Could not find class [myproject/tests/ParserTest]
...