Reputation: 1690
I'm starting use the IntelliJ-IDEA
, but my java
files doesn't detect errors like imports for example. I don't create one project java
, because i'm using different languages in same project, but I want that in the java
files, he detect the errors. How can I make this?
Upvotes: 1
Views: 9441
Reputation: 422
Upvotes: 0
Reputation: 825
I have the same problem where Intellij doesn't detect even a String, When your Intellij behaves abnormally, finds errors where there are none, outdated debugging, etc. It may be necessary to invalidate its cache (which is easily corruptible). You go to:
And select Clear file system cache option
After clicking on Invalidate and Restart the problem should be resolved.
Upvotes: 1
Reputation: 76
In my case only java.* imports were not detected.
These are the steps I did
Upvotes: 0
Reputation: 2136
Intellij can work very well standard project layouts. If yours is not standard - tell Intellij how it is structured: from open workspace, select File -> Project Structure (Ctrl+Alt+Shift+S), and go through all the tabs to setup specifics:
The most important tabs are probably:
Assume you have two java files in your project:
package com.myproject // this one have package
public class SomeClass{
//whatever
}
and
public class Main {
// whatever - no package
}
so you should have them inside some directory:
directory
|- com
| |- mypackage
| |- SomeClass.java
|- Main.java
In such structure - the directory
is sources root. Mark it as such
Upvotes: 2