Skip to content
Advertisement

Intellij doesn’t recognize package

i got this sample solution from my Professor, but somehow it isn’t working. IntelliJ does not recognize the packages. That’s the case for every class. When I hover over it it says: “Package name ‘spaceman.view.util’ does not correspond to the file path ‘view.util’ ” Has anyone any idea what could be wrong? I’m a total beginner when it comes to coding so sorry, if the question is banal.

Thank you!!

IntelliJ Screen

Advertisement

Answer

Your project spaceman is the sources root. That means anything inside a folder view/welcome in that folder is supposed to be in the package view.welcome. If you want to keep the package spaceman.view.welcome then move the whole tree into another folder spaceman inside your spaceman project directory.

Note that it’s rather unusual to have the project root itself be the source root. It’s way more common to have a directory like src/ be the source root (or, if you follow the Maven/Gradle convention something like src/main/java).

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement