The declared package does not match the expected package
2017-11-14 16:43
1096 查看
eclipse使用import导入源代码到项目中或者通过svn检出等方式导入源码到项目中,控制台容易出现大量错误。
但同时直接使用ant脚本进行编译则能编译成功。
这个时候请不用担心,打开错误可以看到在很多类的开头部分:package出现错误,提示为:
The declared package does not match the expected package
错误的原因是:
eclipse中包的定义一般是通过package包名产生,而不是通过文件的层次来定义。eclipse使用import导入源码时,导入的是文件结构而不是包形式,故报错。
解决方法:
点击> properties > java build path > source > add folder > select
然后重新编译就ok了。
但同时直接使用ant脚本进行编译则能编译成功。
这个时候请不用担心,打开错误可以看到在很多类的开头部分:package出现错误,提示为:
The declared package does not match the expected package
错误的原因是:
eclipse中包的定义一般是通过package包名产生,而不是通过文件的层次来定义。eclipse使用import导入源码时,导入的是文件结构而不是包形式,故报错。
解决方法:
点击> properties > java build path > source > add folder > select
src/XXXX
然后重新编译就ok了。
相关文章推荐
- JDBC产生The declared package does not match the expected package
- The declared package does not match the expected package
- The declared package "com.dao" does not match the expected package "src.com.dao"
- 解决:The declared package..does not match the expected package..(转自百度空间)
- The declared package does not match the expected package
- The declared package does not match the expected package
- The declared package does not match the expected package
- The declared package "com.dao" does not match the expected package "src.com.dao"
- The declared package "com.hddaily.socketpool" does not match the expected
- Eclipse: The declared package does not match the expected package
- The declared package "com.XXX" does not match the expected package ""
- 如何处理Eclipse错误消息 The declared package does not match the expected package
- The declared package does not match the expected package
- The declared package "" does not match the expected package
- The declared package "" does not match the expected package "javaControlSql"
- The declared package does not match the expected package
- The declared package..does not match the expected package
- The declared package "com.XXX" does not match the expected package ""
- 解决:The declared package does not match the expected package
- eclipse 中导入源码出现 The declared package does not match the expected package的解决方法