Could not determine java version on windows 10, java 11.0.7

I have Java 11.0.7 and gradle 6.8 installed. When I run gradlew build for a java project, I get error:

gradlew build

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine java version from ‘11.0.7’.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

Whats wrong here?

The gradlew command specifically uses the version of Gradle that’s configured for the project. This is generally the preferred method as it makes sure that you don’t have to manually install many different versions and know which projects are compatible with which versions. The project in question is likely not compatible with Java 11.