What does this symbol mean in IntelliJ? (red circle on bottom-left corner of file name, with 'J' in it)

JavaIntellij IdeaTarget

Java Problem Overview


Under the target folder in IntelliJ for a Java project I created, I have a few java source files in the package. Beside each file the 'J' icon has a red circle with a line through it.

What does that mean? How do I fix it?

Java Solutions


Solution 1 - Java

You need to specify the source dir

File> Project Structure > Modules

click the directory and click the Sources button

It's weird because usually it's done automatically. Maybe it's better if you recreate the project again.

Solution 2 - Java

If it is a maven project

  1. right click on the pom.xml
  2. Add As Maven Project

Thanks

Solution 3 - Java

The first answer from irreputable above that starts out with "you need to specify the source dir" is correct, but I don't see him telling you the easy way to do so.

Simply right click on the java sources folder ("java" under src/main/java if it is a Maven project for example) and select Mark Directory As > Sources Root (see screenshot below).

enter image description here

Solution 4 - Java

This situation happens when the IDE looks for src folder, and it cannot find it in the path. Select the project root (F4 in windows) > Go to Modules on Side Tab > Select Sources > Select appropriate folder with source files in it> Click on the blue sources folder icon (for adding sources) > Click on Green Test Sources folder ( to add Unit test folders).

Solution 5 - Java

Find all IntelliJ (v15) symbols over here: https://www.jetbrains.com/idea/help/symbols.html

This site states that this icon stands for "Java class located out of the source root. Refer to the section Configuring Content Roots for details."

Solution 6 - Java

First mark the directory as the source root. Then go to the pom excel and right click on it. select add as maven project .

Solution 7 - Java

Another option if you're using Flavors in Android Studio:

Click Build -> Select Build Variant.

In the list click the variant you're working in and it will turn green and the others will have the red J.

Solution 8 - Java

Press F4 at the project root and select the the root source pressing the source button. It resolved my problem!

for(; ;){
  makeGoodCode();
}

Solution 9 - Java

As mentioned earlier,

  1. right click on the pom.xml

enter image description here

  1. Add As Maven Project

enter image description here

Solution 10 - Java

I downloaded a project from github with .idea folder. After deleting that folder, everything was ok.

Solution 11 - Java

Actually this can happens because of two reason.

  1. Your project not getting/ Updating your dependencies. Go to your terminal and enter mvn clean install. Or right click on pom.xml and click Add as Mevan Project.

  2. Check your jdk has set properly to the project.

Solution 12 - Java

This was killing me as I had the same issue. I just going over old projects. Really redoing old lessons from class to get more practice. The repos just have compatibility issues. So I import the project. Then add the source like others state. Then close the project. Delete the .idea directory in the root and re-import project.

Solution 13 - Java

It means those files aren't part of the project settings.

Solution 14 - Java

mark the java folder as source root.It will solve.

Solution 15 - Java

Maybe your project has not been as android project by android studio, please make sure that plugin 'android support' has been enabled(Android Studio Preferences -> Plugins -> Select Android Support)

Solution 16 - Java

Close Android Studio and delete .idea and .gradle folder from project structure and start Studio again.

Solution 17 - Java

It means your Java source files aren't part of the project.

If the suggestions mentioned here don't resolve the issue, you may have hit a rare bug like I did. Researching the exceptions found in the log helped me. In my case, disabling the "Plugin DevKit", deleting the .idea directory, and reimporting the project worked.

Solution 18 - Java

This is what worked for me

  1. Press File from the toolbar
  2. Press Sync Project with Gradle Files

Solution 19 - Java

For a gradle project "./gradlew --stop" will help to resolve the problem when the source directory is correctly specified and project is properly synced.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTERACytEView Question on Stackoverflow
Solution 1 - JavairreputableView Answer on Stackoverflow
Solution 2 - JavaDjalasView Answer on Stackoverflow
Solution 3 - JavaEric GreenView Answer on Stackoverflow
Solution 4 - JavaHari PalappettyView Answer on Stackoverflow
Solution 5 - JavacrazyGuyView Answer on Stackoverflow
Solution 6 - Javasandamal wijeweeraView Answer on Stackoverflow
Solution 7 - JavaDunfieldView Answer on Stackoverflow
Solution 8 - JavaHomilzio Trovoada SantosView Answer on Stackoverflow
Solution 9 - JavaArefeView Answer on Stackoverflow
Solution 10 - JavaShohamView Answer on Stackoverflow
Solution 11 - JavaDas_JView Answer on Stackoverflow
Solution 12 - JavaSpillzView Answer on Stackoverflow
Solution 13 - Javauser146043View Answer on Stackoverflow
Solution 14 - JavaMukund BSView Answer on Stackoverflow
Solution 15 - JavaHard SongView Answer on Stackoverflow
Solution 16 - JavaRamakantView Answer on Stackoverflow
Solution 17 - Javauser3325776View Answer on Stackoverflow
Solution 18 - JavaRay RojasView Answer on Stackoverflow
Solution 19 - JavaSoma KunduView Answer on Stackoverflow