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

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.


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


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