Ok, thanks.
So I had a closer look at the stacktrace you posted.
But that is pretty much confusing.
In Java 9 there were many changes.
One change was, that PlatformClassLoader
does not implement URLClassLoader
anymore (it is an internal class anyway). Your stacktrace says that Gradle is trying nevertheless to cast the former to the latter and of course fails.
Another change in Java 9 was, that it does not contain a tools.jar
anymore.
Actually Gradle checks whether a tools.jar
is available in the JDK used to run Gradle and if it finds one, only then does that cast to inject the tools.jar
into the system class loader.
So the code that fails for you should not actually run, as tools.jar
is not present on a Java 17.
Does your Java installation that is used there come with a tools.jar
in the lib
folder?
Or did you put a tools.jar
there yourself?
Either way, you should probably open a bug report for Gradle to handle the case that there is a tools.jar
found but the class loader not being of the correct type more gracefully.