The declared package does not match the expected package

Eclipse uses import to import the source code into the project or SVN check-out to import the source code into the project. The console is prone to a large number of errors.

But at the same time, it can be compiled successfully by directly using ant script.

Don't worry at this time. You can see the opening error at the beginning of many classes: there is an error in package, and the prompt is:

The declared package does not match the expected package

The reason for the error is:

The definition of package in eclipse is generally generated through the package name, rather than through the hierarchy of files. When eclipse uses import to import the source code, it imports the file structure instead of the package form, so an error is reported.

resolvent:

Click > Properties > java build path > source > Add Folder > select Src / XXXX

Then recompile it.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>