JUnit:NoClassDefFoundError:org / junit / runner / manipulation / Filter [英] JUnit: NoClassDefFoundError: org/junit/runner/manipulation/Filter

查看:515
本文介绍了JUnit:NoClassDefFoundError:org / junit / runner / manipulation / Filter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行某些单元测试时,会引发以下错误:

When I try to run some unit tests, the following error is raised:

java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadTestLoaderClass(RemoteTestRunner.java:320)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:310)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:305)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:283)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:207)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:191)

我必须提到junit-4.11.jar已添加到项目中建立路径。任何想法?

I have to mention that junit-4.11.jar is added to project build path. Any ideas?

推荐答案

即使我遇到同样的问题,请尝试以下步骤 -

Even I was facing the same issue, so try the below steps -


  1. 在Package Explorer中右键单击项目,然后单击Properties。

  2. 单击Libraries选项卡。

  3. 单击添加库按钮。

  4. 选择JUnit并单击下一步。

  5. 选择JUnit 4(这就是我正在使用的)。

  6. 点击完成。

  7. 现在右键单击包含单元测试的文件,然后选择属性。

  8. 在Run /下调试设置,从该文件的启动配置中删除任何条目。点击确定。

  1. Right click the project in Package Explorer, and click Properties.
  2. Click the Libraries tab.
  3. Click the Add library button.
  4. Select JUnit and click Next.
  5. Select JUnit 4 (that's what I am using).
  6. Click finish.
  7. Now right click the file containing unit tests and select Properties.
  8. Under the Run/Debug settings, remove any entries from the Launch Configurations for that file. Hit ok.

希望你现在可以运行测试。

Hopefully you'll be able to run the tests now.

这篇关于JUnit:NoClassDefFoundError:org / junit / runner / manipulation / Filter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆