简体   繁体   中英

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!!

智能屏幕

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 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM