Matthew Lowe Matthew Lowe - 20 days ago 6
Groovy Question

Groovy - get JAVA_HOME from program

I need to obtain JAVA_HOME property from Groovy (Gradle), does anyone know how to achieve this? Only way I can think of is somehow executing this from cmd line via Exec.

Thanks
(I'm running Windows btw :))

Answer
System.properties.find { it.key == "java.home" }