在IDEA里面已经新建好了一个类,并加入了内容,然后创建测试类,快捷键(Ctrl+Alt+T)或者如图右键 Goto Test

Intellij IDEA junit 使用之org.junit不存在


创建后运行报错:

Error:(3, 24) java: 程序包org.junit不存在


点到代码中红色的部分显示:

Cannot resolve symbol 'junit'


解决:

File -> Project Struct... -> Libraies -> 点击绿色的加号 -> Java -> 找到 IDEA 安装路径下的 Lib 中的junit-4.12 -> 确定完就行了,点击OK就出去了


Intellij IDEA junit 使用之org.junit不存在

相关文章:

  • 2021-06-21
  • 2021-04-22
  • 2021-11-17
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2023-03-20
  • 2022-12-23
猜你喜欢
  • 2021-05-25
  • 2021-04-18
  • 2021-09-09
  • 2021-06-19
相关资源
相似解决方案