Oleksandr Savchenko
Oleksandr Savchenko

Reputation: 692

Could not find class Java JUnit

I'm begginer in Java. Can you help me to find error? I run this using command line in Windows from the root folder of project.

java -classpath lib/junit.jar;classes/ua/edu/sumdu/j2se/savchenko/pr2/Task.class
org.junit.runner.JUnitCore ua.edu.sumdu.j2se.savchenko.pr2.tests.TaskTest

My files location:

classes/ua/edu/sumdu/j2se/savchenko/pr2/Task.class
classes/ua/edu/sumdu/j2se/savchenko/pr2/tests/TaskTest.class
lib/junit.jar

Upvotes: 2

Views: 3512

Answers (2)

duffymo
duffymo

Reputation: 308858

java -classpath lib/junit.jar;classes 
org.junit.runner.JUnitCore ua.edu.sumdu.j2se.savchenko.pr2.tests.TaskTest

Upvotes: 4

Dave Newton
Dave Newton

Reputation: 160231

Your class path should only include the root of the class hierarchy, not the complete path to a class.

Also, it's important to include what the exact error is when asking questions, otherwise we're usually guessing.

Upvotes: 3

Related Questions