This forum is about Gradle, not Java.
But as the license changed as is mentioned in red, you might anyway want to not use the Oracle distribution, but instead Temurin.
And you might want to use a more recent version, Java 8 is very old, there are even two LTS versions release after it, 11 and 17.