Unresolved reference: Jvm

i got error when I change build.gradle to build.gradle.kts
I got error when import JVM in this file

code:

import org.gradle.internal.jvm.Jvm

  • buildscript{*

var currentJvm =Jvm.current()
println(“use java ;$currentJvm”)

}

error
Cause: invalid type code: 61
Script compilation error:

Line 27: var currentJvm =Jvm.current()
^ Unresolved reference: Jvm

\build.gradle.kts:27:31: Unresolved reference: Jvm

Hello,

i got one Solution but i am not sure this a way to impliment in .kts file

var currentJvm = org.gradle.internal.jvm.Jvm.current()
println(“usejava $currentJvm”)

i don’t have any error when i this code.
if there any easy way to this code please tell me

thank you