Skip to content

Instantly share code, notes, and snippets.

@henrik242
Created August 3, 2016 08:50
Show Gist options
  • Save henrik242/5f1d802e0e3a33f8ca63152fd5206785 to your computer and use it in GitHub Desktop.
Save henrik242/5f1d802e0e3a33f8ca63152fd5206785 to your computer and use it in GitHub Desktop.
Poor man's /usr/bin/groovy
#!/usr/bin/env bash
# poor man's /usr/bin/groovy :)
if test -x "$(which java)"; then
JAVAEXEC="$(which java)"
elif test -x "$JAVA_HOME/bin/java"; then
JAVAEXEC="$JAVA_HOME/bin/java"
else
echo "ERROR: Could not find java binary"
exit 1
fi
GROOVYJAR=$(find /path/to/jars -name 'groovy-all-*.jar' -print -quit)
if test -z "$GROOVYJAR"; then
echo "ERROR: Could not find the groovy-all jar!"
exit 1
fi
$JAVAEXEC \
-classpath $GROOVYJAR:. \
org.codehaus.groovy.tools.GroovyStarter \
--main groovy.ui.GroovyMain \
$@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment