[英]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) 我确实提供了一个文件夹结构,例如:任务->与任务相关的非源文件,src->(package1->类),(package 2类)
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. 现在,每当我将task / src添加到构建路径时,Eclipse总是给我错误的软件包-它总是说它想要src.package1而不是仅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? 我想这是因为它已将task解释为basefolder,而src已经作为第一个软件包-我如何使Eclipse了解src不是软件包?
I am using Eclipse Indigo, and I am not allowed to change the folder structure. 我正在使用Eclipse Indigo,并且不允许更改文件夹结构。 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 lib-Ab
Then opened the Build properties, and added lib/ab as a source folder. 然后打开Build属性,并将lib / ab添加为源文件夹。 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). 然后,我在lib / ab源文件夹的ab包中创建了一个ABC.java,并且它可以工作(在Eclipse Indigo中,并且我有把握地肯定它也可以工作)。
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
. 因此,我建议从构建路径中删除src
,而是添加src/package1/classes
和src/package2/classes
。
Note that the compiled classes will go as before in the bin
folder now for both packages. 请注意,对于这两个软件包,已编译的类现在将像以前一样进入bin
文件夹中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.