无法解析JUnit导入 [英] JUnit import cannot be resolved

查看:183
本文介绍了无法解析JUnit导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试为Java项目(Eclipse)创建JUnit测试.但是,每当我向项目中添加新的JUnit测试用例时,就会不断出现奇怪的错误: https://ibb.co/ekon9J 当我尝试使用Eclipse的快速修复功能时,尽管它已经存在,但它再次将JUnit 5添加到了构建路径.一切似乎都已正确设置,但仍然无法正常工作.我尝试按照类似线程中的建议清理/关闭项目.不幸的是,没有任何帮助.有人对这里发生的事情有想法吗?

I'm currently trying to create JUnit tests for my Java project (eclipse). However, a weird error keeps showing whenever I add a new JUnit Test Case to my project: https://ibb.co/ekon9J When I try to use the Quick Fix function of the Eclipse, it adds the JUnit 5 to the build path again, although it's already there. All seems to be set up correctly, but it's still not working. I tried cleaning/closing the project as someone suggested in a similar thread. Unfortunately, nothing helped me. Does anyone have an idea on what's going on here?

:这是Java Build Path库选项卡的打印屏幕: https://ibb.co/dUgiGy

: Here's the print screen of the Java Build Path libraries tab: https://ibb.co/dUgiGy

推荐答案

最后,得到了答案.就我而言,解决方案是将Build路径中的JRE更改为Java SE 1.8.现在一切正常.

Finally, got an answer. In my case, the solution was to change the JRE in Build path to Java SE 1.8. Now everything works fine.

这篇关于无法解析JUnit导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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