1. 程式人生 > >java lang NoClassDefFoundError org/junit/rules/TestRule

java lang NoClassDefFoundError org/junit/rules/TestRule

ews http js xml model ssd launch init ppc ont

1、錯誤描述

java.lang.NoClassDefFoundError: org/junit/rules/TestRule
	at java.lang.ClassLoader.findBootstrapClass(Native Method)
	at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1012)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(Class.java:2570)
	at java.lang.Class.getDeclaredFields(Class.java:1903)
	at org.junit.runners.model.TestClass.<init
>
(TestClass.java:49) at org.junit.runners.ParentRunner.<init>(ParentRunner.java:75) at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:57) 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:26) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init
>
(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

2、錯誤原因

由於junit4.7(包括7.4)之前的版本沒有TestRule這個接口,之後的版本有TestRule這個接口

3、解決辦法

下載junit4.7之後的版本或是最新的版本

再分享一下我老師大神的人工智能教程吧。零基礎!通俗易懂!風趣幽默!還帶黃段子!希望你也加入到我們人工智能的隊伍中來!https://blog.csdn.net/jiangjunshow

java lang NoClassDefFoundError org/junit/rules/TestRule