简体   繁体   中英

Eclipse - how do I create a source folder from a sub folder without making eclipse look for the wrong package names?

I do have a folder structure given such as: task --> task related non-source stuff, src --> (package1 --> classes), (package 2--classes)

Now whenever I add task/src to the build path, Eclipse always gives me errors for the packages - it keeps saying it wants src.package1 instead of just package1. I suppose that is because it interprets task as the basefolder and src already as the first package - how do I get Eclipse to understand that src is NOT a package?

I am using Eclipse Indigo, and I am not allowed to change the folder structure. Help would be appreciated.

I just tried to do the same - I created the following folder structure (at first none of them were source folders):

lib - ab

Then opened the Build properties, and added lib/ab as a source folder. Then I created an ABC.java in the ab package in the lib/ab source folder and it worked (in Eclipse Indigo, and I am reasonably sure that it worked before as well).

You can have multiple source folders on your build path. Therefore I would recommend to delete src from the build path and instead add src/package1/classes and src/package2/classes .

Note that the compiled classes will go as before in the bin folder now for both packages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM