2014-09-26 70 views
0

如何将intelliJ配置为像eclipse这样的java代码中的显式错误? 见截图enter image description here为什么IntelliJ不会在Java代码中显示错误?

+0

什么错误?你的代码对我来说看起来很好。 – 2014-09-26 08:59:00

+0

没有junit套件错过 – Ronald 2014-09-26 09:00:38

+0

是的,这是问题所在。 eclipse显示junit包丢失,但intellij不会在编辑器上显示任何错误 – 2014-09-26 09:03:59

回答

2

它确实表明,如果你没有在classpath中JUnit的jar文件你所期望的错误,

我创建完全相同的文件,你在我的IntelliJ表明,它确实显示了错误:

enter image description here

什么,你可能会做的是,你有可能不小心添加的jar到classpath中。

请检查External Libraries,如图所示。如果那里没有JUnit,那么它确实缺少。

现在,我可以很容易地从添加的IntelliJ JUnit的罐子,你会发现在External Libraries的区别:

enter image description here

这已External Libraries下添加和错误消失。

enter image description here

0

你几乎可以肯定已经列入junit库到您的IntelliJ项目配置。

这很容易做到,因为IntelliJ对Add junit to classpath有一个快速操作(alt-enter)。

查看Settings - >图书馆/全球图书馆,你会在那里看到它。 :)

或者你可以直接看在Settings在相关模块 - >依赖关系

要么,你的工作在项目中已经配置有一个JUnit依赖(可能通过行家?)。

相关问题