java - java.lang.NoClassDefFoundError:org/hamcrest/SelfDescribing

标签 java eclipse junit noclassdeffounderror hamcrest

junit中运行eclipse测试时,我得到了这个Exception:

java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

我添加了junit.jar库文件。

我尝试了不同版本的junit.jar:4.44.8等。

如何解决此异常?

最佳答案

hamcrest-all-X.X.jar添加到您的类路径中。

截至2015年2月的最新版本为1.3:
http://code.google.com/p/hamcrest/downloads/detail?name=hamcrest-all-1.3.jar&can=2&q=

关于java - java.lang.NoClassDefFoundError:org/hamcrest/SelfDescribing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35652988/

相关文章:

java - Excel 文件的条件格式

android - 在 Eclipse (Android) 中使用 main.xml 的问题

java.lang.NoSuchMethodError : javaxservlet. http.HttpServletRequest.isAsyncStarted()Z

java - Eclipse 仅从测试文件夹加载 log4.properties

java - eclipse 调试变量导出或打印

java - JUnit核心 : the best way to test java files or are there better ways?

java - jUnit测试中的访问方法变量

java - Firefox 缓存路径构建 Mac OS X

java - 用 Java 开发的可定制模块化 GUI

java - 如何在 UML 中表示 X 接口(interface)的 Java 属性与所述接口(interface)的关系?