0

Ctrl+N on IntelliJ (Ultimate 2020) is not finding Java files.

To troubleshoot this I've tried:

  • Ensuring correct JDK is configured
  • Ensuring no errors listed in the event log
  • Ctrl+N filter has Java selected

I have two installs of IntelliJ - it works one and not the other. I cant't figure out the difference.

What am I missing?


Update: I notice in the instance where this works the .java files in the source tree have a C or I icon for class/interface. In the one which doesn't work they have a file icon with a red dot in the lower left corner. That is odd....

Marcus Leon
  • 55,199
  • 118
  • 297
  • 429

2 Answers2

1

The icon with a J in an orange circle represents Java classes located outside of the sources root.

enter image description here

So basically the answer is, you need to mark the directory with your Java classes as a Sources Root in order for IDEA to know that this is your production code, and these are the files eligible for compilation, as well as code completion, navigation, etc.

enter image description here

After that, the icons will turn blue, and the classes will become searchable:

enter image description here

Koyasha
  • 5,275
  • 2
  • 8
  • 17
  • P.S. Maven settings re specifying the directory of your sources root on reimporting a project can be found [here](https://www.jetbrains.com/help/idea/maven-importing.html). – Koyasha Jun 18 '20 at 13:58
  • Thanks, that worked. See my answer below for the steps I followed – Marcus Leon Jun 18 '20 at 14:32
0

This question led to the solution: What does this symbol mean in IntelliJ? (red circle on bottom-left corner of file name, with 'J' in it)

I clicked on the root pom.xml (Maven), right click, Maven, re-import.

Marcus Leon
  • 55,199
  • 118
  • 297
  • 429