 <p><strong>Solution 1 :</strong> One solution that worked for me when this error "<strong>The declared package does not match the expected package</strong>" occured for a project I checked-out from eclipse CVS :</p> <p>1.Right click the project in the navigation bar and click 'delete'<br> 2.Make sure '<strong>Delete project contents on disk</strong>' option is <strong>NOT</strong> checked, and click OK.<br> 3.Now after the project is deleted, go to <strong>File -> Import -> General -> Existing Projects into Workspace</strong><br> 4.Select your workspace from the directory listing and check the box next to your project name. Click '<strong>Finish</strong>' </p> <p><strong>Solution 2 :</strong> Once again I got this error with the following message </p> <p><em>Eclipse build errors - java.lang.Object cannot be resolved</em> I had to follow another route mention here and the error went away.</p> <p>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:</p> <ol> <li>Go to properties of project with the build error (right click > Properties) View the "Libraries" tab in the "Build Path" section Find the "JRE System Library" in the list (if this is missing then this error message is not an eclipse bug but a mis-configured project) </li> <li>Remove the "JRE System Library"</li> <li>Hit "Add Library ...", Select "JRE System Library" and add the appropriate JRE for the project (eg. 'Workspace default JRE')</li> <li>Hit "Finish" in the library selection and "OK" in the project properties and then wait for the re-build of the project</li> </ol> <p>Hopefully the error will be resolved ...</p>