Skip to content

Instantly share code, notes, and snippets.

@chocolateboy
Last active June 8, 2018 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chocolateboy/8196ec2ec4485021048a7b4ffd048890 to your computer and use it in GitHub Desktop.
Save chocolateboy/8196ec2ec4485021048a7b4ffd048890 to your computer and use it in GitHub Desktop.
Portably determine $GROOVY_HOME, $KOTLIN_HOME, $SCALA_HOME etc.
jvm-home() {
    JAVACMD=$(which echo) "$1" | tr -s '[:space:]' '\n' | grep -F "$1.home=" | cut -d= -f2
}
$ jvm-home groovy
/usr/share/groovy

$ jvm-home kotlin
/usr/share/kotlin

$ jvm-home scala
/usr/share/scala

See here for the how.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment