Made launcher scripts on OSX find java the recommended way

This commit is contained in:
Vhati 2017-12-31 15:19:13 -05:00
parent e94d553c22
commit a999e1e804
4 changed files with 29 additions and 5 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Get the absolute path to this script's folder.
if echo "$0" | awk '{exit(!/^\//);}'; then
@ -8,4 +8,13 @@ else
fi
cd "${maindir}";
java -jar modman.jar "$@";
java_cmd=$(command -v java);
# OSX uses a command to decide java's location.
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME=`/usr/libexec/java_home`
java_cmd=${JAVA_HOME}/bin/java
fi
${java_cmd} -jar modman.jar "$@";