Solution 1 : One solution that worked for me when this error "The declared package does not match the expected package" occured for a project I checked-out from eclipse CVS :
1.Right click the project in the navigation bar and click 'delete'
2.Make sure 'Delete project contents on disk' option is NOT checked, and click OK.
3.Now after the project is deleted, go to File -> Import -> General -> Existing Projects into Workspace
4.Select your workspace from the directory listing and check the box next to your project name. Click 'Finish'
Solution 2 : Once again I got this error with the following message
Eclipse build errors - java.lang.Object cannot be resolved I had to follow another route mention here and the error went away.
In the mean time, the work around is to remove the JRE System Library from the project and then add it back again. Here are the steps:
Hopefully the error will be resolved ...