Found java version null. Please Help

I was just trying to install forge 1.15.2 MDK ( [Recommended Edition])

When I entered “gradlew eclipse” in cmd and pressed enter it gave me an error.

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users\david\Desktop\Minecraft Modding\TestMod\build.gradle’ line: 11

  • What went wrong:
    A problem occurred evaluating root project ‘TestMod’.

Failed to apply plugin [id ‘net.minecraftforge.gradle’]
Found java version null. Minimum required is 1.8.0_101. Versions 11.0.0 and newer are not supported yet.

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

  • Get more help at