Used by junit, junit
Today, jsoup is used as'Network crawling instance', However, when the author imports the junit-4.11.jar into the project, add @ Test to the method in the class, but the runtime reports an error, the error code is as follows:
java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) ... ... 25 more
After searching on the Internet, it is known that after junit is upgraded to junit4, You need to import the hamcrest jar package to use normally, the author then import the hamcrest-core-1.3.jar in the project, run the project successfully.
NOTE: If junit 3 is used, you only need to import the junit package. For junit 4, you need to import the junit and hamcrest packages.