This tutorial provides the solution to the error thrown by Eclipse for Java projects - 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.
Try to close the project and re-open it. In several cases, this might solve the issue.
Install the most recent version of Eclipse on your system and open the project using the newly installed JRE. It will resolve the issue.
Your Eclipse build is older than the Java version. In such cases, the eclipse will throw errors in case your project is configured for the newer version of Java as shown in Fig 1.
Now check your Eclipse Version and try to set the older version of Java installed on your system. No need to change the environment variable to resolve this error. Simply update your project to use the older version of Java. Now right-click the project -> Properties -> Java Build Path -> Libraries as shown in Fig 2.
Now double-click the JRE -> Alternate JRE -> Installed JREs to view the available JREs as shown in Fig 3.
Click the Add Button -> Standard VM and choose an older JRE. I have selected Java 12 as shown in Fig 4 since my Eclipse version was eclipse-java-2019-06-R-win32-x86_64.
Click the Finish Button and change the project JRE as shown in Fig 5.
Now click the Apply and Close Button. It will change the default JRE for the Eclipse installation. Now you can also configure the Project JRE as shown in Fig 6.
Keep the Workspace default JRE selected and click the Finish Button. It will change the project JRE as shown in Fig 7.
Click the Apply and Close Button to apply the changes. It should resolve your error and Eclipse should not complain about the missing class file java.lang.Object.
This tutorial provided the possible solutions to the Eclipse error Cannot find the class file for java.lang.Object.