user3368646
user3368646

Reputation: 53

Why does Eclipse not allow me to create sub folders correctly?

When I'm trying to create a folder structure in my Resources folder, Eclipse messes it up.

For example I have an image stored in /Resources/Graphics/SomeFolder/example.gif

In the Package/Project Explorer I have then an empty package Graphics and a different package called Graphics.SomeFolder. Now I can't load the image when I try to access is with the normal path.

For clarification I created this folder structure \Resources\graphics\images\subfolder\image.gif and this is what Eclipse makes of it:

Screenshot
(source: 666kb.com)

Upvotes: 5

Views: 4161

Answers (2)

XelaNimed
XelaNimed

Reputation: 315

The solution proposed by Sanjeev (use the context menu item "New"->"Folder" in resource folder) does not work for me in Eclipse 2022-12 (4.26.0). I found that to display folders instead of packages, you need to set the Excluded filter as a pattern **. To do this, in the "Java Build Path" select the "Excluded" item in the properties of the resources folder, then click on the "Edit" button and in the window that appears add the "**" pattern to the "Exclusion patterns".

Add exclusion pattern to resource folder

Resource subfolders as packages Resource subfolders as folder

Upvotes: 0

Sanjeev
Sanjeev

Reputation: 9946

This is happening because your Resources folder is created as a "source folder". So it is displaying subfolders as a package structure. Define your Resources folder as a normal folder using "New -> Folder"

Upvotes: 3

Related Questions