クラスParserTest
はパッケージ内にあり、次のmyproject.tests
ディレクトリ構造に格納されています。
.
└── myproject
└── tests
└── ParserTest.class
現在のシェル セッションの CLASSPATH を設定します ( -cp
Java 呼び出しをクリーンに保つためのオプションはありません)。
export CLASSPATH=.:/usr/local/lib/java/junit-4.12.jar:/usr/local/lib/java/hamcrest-core-1.3.jar
JUnit ランナーを呼び出し、テスト クラスを引数として渡します。
java org.junit.runner.JUnitCore myproject/tests/ParserTest
このエラーがスローされます:
...
1) initializationError(org.junit.runner.JUnitCommandLineParseResult)
java.lang.IllegalArgumentException: Could not find class [myproject/tests/ParserTest]
...