Skip to content

Instantly share code, notes, and snippets.

@tiwiz
Forked from Takhion/build.gradle
Last active August 29, 2015 14:22
Show Gist options
  • Save tiwiz/9564d8d6869a06d80d01 to your computer and use it in GitHub Desktop.
Save tiwiz/9564d8d6869a06d80d01 to your computer and use it in GitHub Desktop.
String getJavaHome(String version)
{
def stdout = new ByteArrayOutputStream()
exec {
commandLine "/usr/libexec/java_home", "-v", version
standardOutput = stdout;
}
return stdout.toString().trim()
}
retrolambda {
jdk System.getenv("JAVA8_HOME") ?: getJavaHome("1.8")
oldJdk System.getenv("JAVA7_HOME") ?: getJavaHome("1.7")
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment