I see you’re using IntelliJ IDEA for this. This is what worked for me: Go to the settings –> Build, Execution, Deployment –> Build Tools –> Gradle. Click on your gradle project under ‘Gradle Projects’. Choose your Gradle JVM for the project… in my case it was openjdk-19. Now it should work.