Could not find class Java JUnit

妖精的绣舞 提交于 2019-12-24 02:08:35

问题


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

回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/7667436/could-not-find-class-java-junit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!