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 :))
System.properties.find { it.key == "java.home" }
A gotcha that bit me. Remember to use curly braces inside a gstring.
println "inside a gstring, java.home=$System.properties.'java.home' will be problematic
//dumps all system properties
but
println "inside a gstring, java.home=${System.properties.'java.home'} will be fine
Result: inside a gstring, java.home=C:\FAST\JDK64\1.7.0.79\jre will be fine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With