Build path is incomplete. Cannot find the class file for java.lang


When opening a Gradle project via buildship I get following for error for all sub projects and compilation fails with many errors as it can’t find classes under java.lang package which suggests JDK is not properly in class path.

“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”

When checking the project build path after buildship is done, I can see correct JDK version added under module path and dependencies resolved.

Can someone please let me know what I am doing wrong?


Each project has following defined on Gradle level:

java {
sourceCompatibility = JavaVersion.VERSION_13
targetCompatibility = JavaVersion.VERSION_13

Eclipse has jdk-14+36 added and linked with JavaSE-13 execution environment.

jdk-14+36 is also in PATH and gradle daemon is using it.


Version: 2020-03 (4.15.0)
Build id: 20200313-1211

Gradle wrapper


Check the content of the .classpath file in your projects. You should see a classpath entry for your JDK similar to this:

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>

This only specifies that a specific JDK version is required for your project. The mapping between JDK versions and local installations is handled by Eclipse. Check the JDKs known to your Eclipse instance in the preferences (Menu > Preferences > Java > Installed JREs) and verify that a proper version is available.

Also, the build path UI should give you clues what’s broken. Right-click on your project and select Build Path > Configure Build Path.... The tabs on the dialog should have elaborate error messages.

I’ve run into a similar problem. I have JDK 11 installed and assigned as suggested, the Configure Build Path shows no errors, yet Eclipse won’t build my project if I set it to sourceCompatibility > 1.8.