We are creating a project in Eclipse studio, building the project and it executes. Everything goes fine and smooth. Next time we open the Eclipse studio and see red cross mark error beside our imports on basic java class references. To be more specific, we get the following issue:
The project was not built since its build path is incomplete. Cannot find the class file for xxxxx. Fix the build path then try building this project
Here xxxxx can be any of the java class file. We wonder why we get this and that it didn’t happen when we worked on the project just before Lunch!!! Annoying huh.. Ok so what is the problem and how to get rid of this ASAP? Well…the problem is with the reference of java library in our project. Sometimes Eclipse loses the reference path and require us to help it out. And how do we do that…here are the steps:
1. Right click on the project from the Project Explorer and select “Properties”. Alternatively we can also select “Properties” from the Project menu.
2. From the Properties dialog, select “Java Build Path” from the left side view.
3. Clicking the “Libraries” tab we can see the libraries referenced in the project and will also see that something is wrong with JRE library referenced in the project as shown below:
4. Next we select this library and remove it. Then we click the “Add Library…” button on the right and then select the “JRE System Library” and then click the “Next” button as shown below:
5. By default, we will see that “Workspace default JRE” is selected as shown below. We can leave this as is and then click the “Finish” button
Now that we have the JRE library referenced to the project, we should see the error go away. But sometimes not. In this case, we do the regular clean-up of the project as follows:
2. Right click on the project from “Project Explorer” and “Refresh”
3. Right click on the project from “Project Explorer” and under "Android Tools" click “Fix Project Properties”
4. May be even restart Eclipse if the above 3 steps doesn’t work and then repeat the 3 steps after restarting
Finally we see the error go away. Whew….
Hope this helps reduce your headache and…