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

后端 未结 14 644
失恋的感觉
失恋的感觉 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:17

    Creating a package makes an older one instead.

    I had the same problem, and I was not able to solve it. But I suggest this, as a possibility. After copying and moving classes between packages, any file, it could be that the classpath has different information and that it hasn't been updated.

    After having read some comments above, I now am only using source folders instead the standard source Folder "src". Inserting packages in any new source folder always runs.

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

    i had the exact same Problem after i added the packege in java build path -> libraries -> add class folder...

    Dont ask why i did this ^^ but to resolve the Problem i just had to go to Project->Properties->java build path->Source

    And there it was in the Excluded part. Just remove it from the exclusion pattern and perhaps also from the libraries section.

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

    Right click on Project > Configure > Convert to Faceted Form > Click on apply and OK

    This one has worked for me.

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

    go into your javabuildpath in properties and remove the folder from your Exclusions

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

    No Need of delete, re-create etc.

    Just modify .classpath file

    <classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java">
        <attributes>
         ........
    
    0 讨论(0)
  • 2021-01-04 00:22

    First, ensure that you're in the "Package Explorer" view of the Java Perspective.

    Secondly, it needs to be made a Source Folder.

    If you're in the Java Project, right click on the folder and select "Build Path" > "Use as Source Folder"

    Something like what is shown here:

    Observe that I am in Java perspective and see how the style of the folders "source" and "src" are different in appearance.

    Eclipse Screenshot

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