IntelliJ can't find classes in same package when compiling

15,676

Solution 1

This is because BifCreatorController is excluded from compilation (see the small "X" top-left icon near to the file name). One reason would be the file got some errors while compiling, IDEA proposed to exclude it from compilation and you had accepted.

Go to "File > Settings > Build, Execution, Deployment > Compiler > Excludes" and remove it from there.

Solution 2

Got same problem today. Rebuilding or restarting both didn't work for me. In the end, I tried to rename the class, problem solved! Then I rename the class to the name I want, everthing was fine!

Solution 3

I had the same problem, i cleared the cache and restarted but it did not solve the problem. Then i right clicked the not found class and selected Recompile and after recompilation the problem was solved.

Solution 4

For those who can't beat the trouble i suggest switching to maven because its predictive:

Maven > Runner > Delegate IDE build/run actions to Maven

Share:
15,676
E.S.
Author by

E.S.

Updated on July 21, 2022

Comments

  • E.S.
    E.S. almost 2 years

    As an extension to my previous question (IntelliJ can't find depencency when compiling, but can in editor.) which got solved, I now have a new issue which has sprung up.

    Within the same packages, references to other classes are showing up with errors:

    enter image description here

    As you can see in the picture, there is happening at the line involving the BifCreatorController, even though that class is in the same package as the BifCreatorView.

    Just like my previous question, I am failing to understand why IntellJ is spitting out those errors. This project works just fine in Eclipse, but I am looking to start moving away from eclipse.