After some surgery on my Eclipse .project and .classpath files, I ran into the following errors in the Problems view:
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project
…and…
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
In my case, these errors were shown only for the "last" Java class within a project. The class declaration line of the affected class had the following error tip:
Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
This issue is caused by a missing JRE (or JDK) from the classpath, which can be added back in a few simple steps:
- Open the affected class file
- Under the Project menu, select Properties)
- Select Java Build Path in the left pane
- Select the Libraries tab in the right pane
- Click the Add Library... button
- Select JRE System Library from the list
- Click the Next > button
- Select the appropriate JRE (usually the Workspace default JRE option is fine)
- Click the Finish button
- Click the OK button to close the project properties.
No comments:
Post a Comment