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?
Thanks.
Each project has following defined on Gradle level:
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.