user2433924
user2433924

Reputation: 49

Running JUnit 4 from command line on Eclipse project

I currently have ClasspathSuite set up to run all of my JUnit tests. I'm working on trying to get the ClasspathSuite class to run from the command line. When I am in the bin directory and run this command:

java -cp /usr/share/java/junit.jar org.junit.runner.JUnitCore MySuite.class

I get:

JUnit version 4.10
Could not find class: MySuite.class

Time: 0.002

OK (0 tests)

I also tried running the same command with the absolute path to the file, resulting in the same error message. What am I doing wrong?

Upvotes: 1

Views: 2772

Answers (1)

seanmk
seanmk

Reputation: 1963

Just take off the .class part. Java knows to look in that file when you specify the class name.

java -cp /usr/share/java/junit.jar org.junit.runner.JUnitCore MySuite

Upvotes: 1

Related Questions