Auto errors detection in IntelliJ IDEA

Java file is not analyzed since it's located outside of the source root. You need to either relocate the file or reconfigure your content roots so that it resides under the folder configured as the Sources root.

Sources root is marked in blue in the project view. Here is the example of the properly configured project (notice the class icon is different than on your screenshot):

java project

source root


One more reason could be IntelliJ is running on power saver mode, this could be disabled following way:

File Menu -> Power Saver Mode


This is finally what worked for me! Phew! My Problem: Whenever I exit Intellij and try to open up an old/existing project, I have trouble getting the builds and execute to work on my localhost. I'm just using localhost.

Here are the steps that finally worked on my localhost environment:

1. Go to Project Structure and Select Project

a. Set the SDK to 10 (“Java Version 10.0.2”) or whatever you are using.

b. (I think this was the main step I was missing) Set the project compiler output to point to where I want the compiled output to sit: C:\Users\kbala\OneDrive - MatrixCare\SoftWLearnings\Javamyfun\NewHelloWorld\out

c. Project Language Level: I chose “SDK Default”

2. Go to Project Structure and Select Modules

a. Click on src (this is where my source code sits).

b. Then, Click on the “Sources” folder icon on the top. This adds src to the “Source folders” on the right. You will see the color change to Blue

c. Click ok.

3. Then, click on “Add Configuration” (top right corner of Intellij)

a. Select + at the top left hand corner.

b. Select “Application”

c. Change the name to “Main”

d. Now click on the Ellipsis (three dots) in “Main Class”. You should now see your Main Class. Select it.

e. You should now see the execute arrow at that top right of Intellij. And you should see the build icon (Hammer).

This should work!


Try this :

1. Invalidate caches and restart IntelliJ

File -> Invalidate Caches / Restart... -> Invalidate and Restart

2. Deactivate the Power Saver Mode

File Menu -> Power Saver Mode

It worked for me.