My Eclipse Java package is treated as a folder; can anyone suggest what's wrong?
A Java package is like a directory in a file system. In fact, on the disk a package is a directory. All Java source and class files of classes belonging to the same package are located in the same directory. Java packages can contain subpackages.
You could try holding down Ctrl + F7 to see a list of all views, then up/down arrow to the View. If Package Explorer is in the list it has been minimised or something. If you select it and still can't see it, try Window → Reset Perspective... to restore all views to their defaults.
A source folder is marked by Eclipse as containing java sources. Then, when you compile your project Eclipse will look for your source code into all your source folders. You can make any folder become a source folder adding it to the java build path.
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.
Well, I actually think you might don't even need the answer anymore (almost two years later) but I will share anyway to document (just found a solution that others could use).
The problem: while searching some packages I accidentally clicked "Add to build path" in a package and after I ctrl+z, the package had became a folder.
The solution I found was on the .classpath. There was a line there with the name of the package I had just added to the build path (even after the Ctrl+Z). Delete that line and after refreshing the project your whole src folder will be turned into a normal folder.
Then right click your src, following this path: src > Build Path > Use as Source Folder.
This solved the problem, I just tested the result. Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With