IntelliJ 编译时在同一个包中找不到类

作为我上一个问题的扩展(

正如您在图片中看到的那样,在涉及 BifCreatorController 的行中发生了,即使该类与 BifCreatorView 位于同一包中.p>

就像我之前的问题一样,我无法理解 IntellJ 为什么会吐出这些错误.这个项目在 Eclipse 中运行良好,但我希望开始远离 Eclipse.

解决方案

这是因为 BifCreatorController 被排除在编译之外(参见文件名附近的左上角小X"图标).一个原因是文件在编译时出现了一些错误,IDEA 建议将其从编译中排除,您已接受.

转到文件 > 设置 > 构建、执行、部署 > 编译器 > 排除"并从那里删除它.

As an extension to my previous question (IntelliJ can't find depencency when compiling, but can in editor.) which got solved, I now have a new issue which has sprung up.

Within the same packages, references to other classes are showing up with errors:

As you can see in the picture, there is happening at the line involving the BifCreatorController, even though that class is in the same package as the BifCreatorView.

Just like my previous question, I am failing to understand why IntellJ is spitting out those errors. This project works just fine in Eclipse, but I am looking to start moving away from eclipse.

解决方案

This is because BifCreatorController is excluded from compilation (see the small "X" top-left icon near to the file name). One reason would be the file got some errors while compiling, IDEA proposed to exclude it from compilation and you had accepted.

Go to "File > Settings > Build, Execution, Deployment > Compiler > Excludes" and remove it from there.

相关文章