3

I created an Intellij project under JDK 1.6. Then I installed JDK 1.7 and removed JDK 1.6.

When I opened the project, I changed JDK to 1.7 in the Project structure dialog.

Project structure dialog box

But my files are not recompiled - if I add errors into my code and select Build -> Rebuild project, no compiler errors appear.

I also tried File -> Invalidate caches without any result.

How can I enable compilation of my source code again?

I'm using IntelliJ IDEA 12.1.4 Ultimate.

Update 1 (23.09.2013 18:48 MSK): I forgot to mention that all Java files appear with a small red J near them.

Small red J

4

3 回答 3

3

这种奇怪行为的原因是我打开的那个里面有一个嵌套的 Intellij 项目。当我打开子项目时,编译开始工作。

于 2013-09-23T14:52:10.360 回答
2

我必须去 Project Settings > Modules 并设置 Source 目录,以便 intellij 知道在哪里查找。谢谢@maba 的评论

于 2015-11-19T18:34:15.113 回答
0

清除编译器输出目录(通常是projectdir/out)中的文件。IntelliJ 只编译更改的文件,文件本身没有更改,因此您需要清除在以前的 JDK 下编译的 .class 文件。

于 2013-09-23T14:40:15.747 回答