Reputation: 152
i was doing some homework in java but intellij doesn't recognize my class. It recognize the main class but it recognize the other class only on the first execution, whenever i modify the code and rebuild it intellij doesn't recognize the other class. I thought it was a jdk problem so i've downloaded an open source jdk but the problem persits. I've found no solutions yet, neither in the intellij forum. It sees the class only if i do a refactor but that's annoying. Mine intellij is up to date(7/5/19).
You can see in the pictures that intellij doesn't give me any problem on the syntax but it says that he cannot resolve "Matrix".
Upvotes: 10
Views: 15378
Reputation: 3467
I had similar issues with IntelliJ not recognizing classes from the Java API (namely ChronoUnit). In my case the IntelliJ version simply was too old and did not fully support Java 21. An update to the newest version helped.
There was a ticket regarding this behaviour on the IntelliJ tracking system: https://youtrack.jetbrains.com/issue/IDEA-333976/Some-java-classes-in-OpenJDK-21-are-not-accessible
Upvotes: 1
Reputation: 139
Came across the same problem that classes are not recognized. Running File
> Invalidate Caches
or File
> Repair IDE
didn't solve the problem for me.
The solution was deleting the .idea
folder within the project and reopen intellij which scans all classes again like it is mentioned here. Hope it helps someone.
Upvotes: 1
Reputation: 436
For me changes in build.sbt
file worked. For example, you can remove some dependency from build.sbt
, press new appeared button Load sbt Changes
in top-right corner in build.sbt
, then revert removed dependency and press again button Load sbt changes
.
Upvotes: 0