IntelliJ IDEA 2023.2.1 (Community Edition)
Build #IC-232.9559.62, built on August 23, 2023
Runtime version: 17.0.8+7-b1000.8 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
ide.experimental.ui=true
This often occurs due to IntelliJ not recognising your project files correctly. To confirm this is I would recommend to:
Reload your build file; either Maven or Gradle
See the IntelliJ documentation for guides: Maven / Gradle
Check that the source files are recognised by IntelliJ as Java classes
You can see this by the file icons; if they are recognised incorrectly they have a small red “J” , if they are recognised correctly the icon will be a blue “C”.