Automatic error detection in IntelliJ IDEA

I am new to Java programming language and IntelliJ IDEA 2017.1 IDE.

I just installed the IDE and I activated all of the various checks, but the IDE cannot detect errors at any time when I make an error, for example, without brackets or semicolons.

Activated checks are displayed on this image:

Activated inspections

This is a screenshot of my code with a few errors but no IDE was detected: screenshot of my code

Please help me solve this problem.

+10
java intellij-idea jetbrains jetbrains-ide
source share
4 answers

The Java file is not parsed because it is outside the source root . You need to either move the file or reconfigure the content roots so that it is in the folder configured as the Sources root.

The source root is marked in blue in the project view. Here is an example of a properly configured project (note that the class icon is different from your screenshot):

java project

source root

+16
source share

This is finally what worked for me! Phew! My problem: whenever I exit Intellij and try to open an old / existing project, it is difficult for me to get the assemblies and do the work on my local host. I just use localhost.

Here are the steps that ultimately worked in my local environment:

1. Go to the project structure and select a project

but. Set the SDK to 10 ("Java Version 10.0.2") or whatever you use.

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

from. Project language level: I selected "SDK Default"

2. Go to the project structure and select the modules

but. Press src (this is where my source code is sitting).

b. Then click the Sources folder icon at the top. This adds src to the "Source folders" on the right. You will see a color change on blue

from. Click OK.

3. Then click "Add Configuration" (Intellij top right corner)

but. Select + in the upper left corner.

b. Select "Application"

from. Change the name to "Main"

e. Now click on the Ellipsis (three dots) in the "Main Class". You should now see your main class. Select it.

e. Now you should see the progress arrow in this upper right corner of Intellij. And you should see the build icon (Hammer).

That should work!

+3
source share

Another reason may be that IntelliJ is in power saving mode, this can be disabled as follows:

File Menu β†’ Power Saver Mode

+3
source share

I struggled with this. Thanks :)

0
source share

All Articles