package Ġru . it basis . jvm wrapper . core . jvm . detector s Ċ Ċ import Ġru . it basis . jvm wrapper . core . jvm . Jvm Type Ċ import Ġru . it basis . jvm wrapper . core . jvm . fix From Mac Ċ import Ġru . it basis . jvm wrapper . core . jvm . get Executable Ċ import Ġjava . nio . file . Path Ċ Ċ object ĠJ vm Type Detector Ġ{ Ċ ĉ @ Throws ( IllegalStateException :: class ) Ċ ĉ fun Ġdetect ( path : ĠPath ): ĠJ vm Type Ġ{ Ċĉ ĉ val Ġbin Path Ġ= Ġpath . fix From Mac (). resolve (" bin ") Ċĉ ĉ return Ġwhen Ġ{ Ċĉĉ ĉ bin Path . is Executable File (" javac ") Ġ-> ĠJ vm Type . JDK Ċĉĉ ĉ bin Path . is Executable File (" java ") Ġ Ġ-> ĠJ vm Type . J RE Ċĉĉ ĉ else ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ-> Ġthrow ĠIllegalStateException (" jvm Ġtype Ġnot Ġdetected Ġfrom Ġpath : Ġ$ path ") Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun ĠPath . is Executable File ( fileName : ĠString ): ĠBoolean Ġ{ Ċĉ ĉ val Ġfile Ġ= Ġget Executable ( fileName ). to File () Ċĉ ĉ return Ġfile . isFile Ġ&& Ġfile . can Execute () Ċ ĉ } Ċ }