Why is my Eclipse Java package being treated as a folder?

后端 未结 14 645
失恋的感觉
失恋的感觉 2021-01-04 00:14

My Eclipse Java package is treated as a folder; can anyone suggest what\'s wrong?

相关标签:
14条回答
  • 2021-01-04 00:28

    SIMPLE You are not in the Package Explorer View ( but in Navigator view) If not the above case, then create a new package under the project (staying in Package Explorer view) and move those classes to the newly created package. DONE.

    0 讨论(0)
  • 2021-01-04 00:29

    This kind of issue occur due to missing of java and test folder in the web application

    solution is :

    Right click on the project folder -> properties -> java build path -> order and export and select the java and test folder and add or apply -> ok

    then you should able to add the package in the java folder

    0 讨论(0)
  • 2021-01-04 00:31

    I tried mvn eclipse:eclipse and it worked. One to watch out is the .project file.

    0 讨论(0)
  • 2021-01-04 00:34

    Just switch to java perspective, in the ide (top right corner-> java...)

    0 讨论(0)
  • 2021-01-04 00:35

    Worst case, you'll have to delete the folder and recreate as a java package.

    • Save the Java classes somewhere else in your Java project by refactoring
    • Delete the folder and the underlying folder structure
    • Create a Java package
    • Move the Java classes back under the Java package by refactoring
    0 讨论(0)
  • 2021-01-04 00:35

    From the menu bar, select Navigate > Show In > Package Explorer.

    This is what worked for me.

    0 讨论(0)
提交回复
热议问题