Class Not Found Exception when running JUnit test

前端 未结 25 846
夕颜
夕颜 2020-12-07 08:32

I am getting this error when running JUnit test in Eclipse:

Class not found com.myproject.server.MyTest
java.lang.ClassNotFoundException: com.myproject.serve         


        
25条回答
  •  庸人自扰
    2020-12-07 09:28

    It's worth mentioning as another answer that if you're using eGit, and your classpath gets updated because of say, a test coverage tool like Clover, that sometimes there's a cleanup hiccup that does not completely delete the contents of /path/to/git/repository//bin/

    Essentially, I used Eclipse's Error Log View, identified what was causing issues during this cleanup effort, navigated to the source directory, and manually deleted the /bin directory. Once that finished I went back to Eclipse and refreshed (F5) my project and the error went away.

提交回复
热议问题