In some cases when I use IntelliJ IDEA for Java projects, I faced this red J mark.

J

This mark means these files are not included current project. So indexes of these files are not generated and search functionality does not work. How can we solve this problem?

The answer is here.

You need to specify the source dir File> Project Structure > Modules click the directory and click the Sources button

So in this wizard, only you have to do is + and add a missing module into your projects. That’s all.

Ref