java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing in Intellij

耗尽温柔 提交于 2019-12-01 14:56:26
muthu

Did you include the hamcrest-core-1.3.jar file in your classpath? If not included means include that jar and try once again.

add junit.jar to your project dependence. you may also need to add hamcrest.jar in addition.

Open File->Project Structure,Click Modules->Dependences,add junit.jar.

Latest version of hamcrest-all is available at: https://search.maven.org/search?q=a:hamcrest-all

Download this version (as opposed to the hamcrest-core) and that should do it.

If you come across this (and a few other threads) on this error and adding the jar to dependencies doesn't work, you will need to add to the general java classpath.

I encountered this error in OSX where maven would download the dependency, but not find it when in fork mode.

Adding all the hamcrest jars to Library/Java/Extensions finally fixed the problem when nothing else would.

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