Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Exception for junit4.12 about org/hamcrest/SelfDescribing #1429

Closed
forvoid opened this issue Mar 12, 2017 · 8 comments
Closed

A Exception for junit4.12 about org/hamcrest/SelfDescribing #1429

forvoid opened this issue Mar 12, 2017 · 8 comments

Comments

@forvoid
Copy link

forvoid commented Mar 12, 2017

hello, guy!
why my use junit4.12.jar thows Exception org/hamcrest/SelfDescribing,no hamcrest ?
java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:36)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
@marcphilipp
Copy link
Member

You need to add the hamcrest-core JAR to the classpath as described here: https://github.com/junit-team/junit4/wiki/Download-and-Install

@forvoid
Copy link
Author

forvoid commented Mar 12, 2017

think you ~ I have add this JAR now .the application is complise. thinks for you answer again

@Mi-La
Copy link

Mi-La commented May 18, 2018

From which version the hamcrest-core is needed? We have used junit-4.10 and we didn't need the hamcrest at all. Was it a change in 4.11? What about some note about it in wiki / doc?

@kcooney
Copy link
Member

kcooney commented May 18, 2018

@Mi-La
Copy link

Mi-La commented May 18, 2018

@kcooney Thanks, I already checked it. It states that there was an upgrade to Hamcrest 1.3 and that JUnitMatchers are now deprecated. But it doesn't say explicitly that I cannot use JUnit without Hamcrest at all. It took me some time to find it out.

@kcooney
Copy link
Member

kcooney commented May 18, 2018

@Mi-La see the section on Maven artifacts

@Mi-La
Copy link

Mi-La commented May 18, 2018

@kcooney Ok, I see. Unfortunately our old project still uses Ant, so I didn't care about the Maven part ;-). Thanks

@geekyouth
Copy link

https://www.cnblogs.com/anny0404/p/5275595.html
image
亲测有效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants