# args for the JVM
declare -a JVMARGS=()
+JAVABIN=""
# set vars for being inside the macos App Bundle
if [ "${ISMACOS}" = 1 ]; then
# MACOS ONLY
SCRIPT="$(readlinkf "$0")"
DIR="$(dirname "${SCRIPT}")"
APPDIR="${DIR%/bin}"
- JAVABIN="${APPDIR}/jre/Contents/Home/bin"
- JAVA="${JAVABIN}/java"
+
+ if [ -d "${APPDIR}/jre" ]; then
+ JREDIR="${APPDIR}/jre"
+ elif [ -e "${APPDIR}/installer.properties" ]; then
+ INSTALLERAPPDIR="$( grep -E '^installer.appdir[[:space:]]*=[[:space:]]*' '${APPDIR}/installer.properties' | sed -E 's/^installer.appdir[[:space:]]*=[[:space:]]*//' )"
+ if [ -d "${INSTALLERAPPDIR}/jre" ]; then
+ JREDIR="${INSTALLERAPPDIR}/jre"
+ fi
+ fi
+ if [ ! -z "$JREDIR" ]; then
+ JAVABIN="${JREDIR}/Contents/Home/bin"
+ fi
if [ "${HEADLESS}" != 1 ]; then
- JVMARGS=( "${JVMARGS[@]}" "-Xdock:icon=${APPDIR}/resource/jalview_logo.png" )
+ JVMARGS=( "${JVMARGS[@]}" "-Xdock:icon=${APPDIR}/resource/jalview_logo.png" )
fi
else
# NOT MACOS
SCRIPT="$(readlink -f "$0")"
DIR="$(dirname "${SCRIPT}")"
APPDIR="${DIR%/bin}"
- JAVABIN="${APPDIR}/jre/bin"
- JAVA="${JAVABIN}/java"
+ if [ -d "${APPDIR}/jre" ]; then
+ JAVABIN="${APPDIR}/jre/bin"
+ elif [ -e "${APPDIR}/installer.properties" ]; then
+ INSTALLERAPPDIR="$( grep -E "^installer.appdir[[:space:]]*=[[:space:]]*" "${APPDIR}/installer.properties" | sed -E 's/^installer.appdir[[:space:]]*=[[:space:]]*//' )"
+ if [ ! -z "$INSTALLERAPPDIR" -a -d "${INSTALLERAPPDIR}/jre" ]; then
+ JAVABIN="${INSTALLERAPPDIR}/jre/bin"
+ fi
+ fi
fi
+JAVA="${JAVABIN}/java"
# headless java arguments
if [ "${HEADLESS}" = 1 ]; then
declare -a JARPATHS=()
# look for getdown.txt -- needed to create classpath
-if [ \! -e "${GETDOWNTXT}" ]; then
+if [ ! -e "${GETDOWNTXT}" ]; then
echo "Cannot find ${GETDOWNTXT}" >&2
exit 3
fi
fi
# look for bundled JRE. Might not be there if unix installer used in which case just invoke "java"
-if [ -e "${JAVABIN}/${NAME}${JAVAEXT}" ]; then
+if [ ! -z "${JAVABIN}" -a -e "${JAVABIN}/${NAME}${JAVAEXT}" ]; then
JAVA="${JAVABIN}/${NAME}${JAVAEXT}"
fi
# If not just try one in the PATH (we need .exe in WSL, added above)
-if [ \! -e "${JAVA}" ]; then
+if [ -z "${JAVABIN}" -o ! -e "${JAVA}" ]; then
JAVA="${SYSJAVA}"
echo "Cannot find bundled ${JAVA}, using system ${SYSJAVA} and hoping for the best!" >&2
fi
function quotearray() {
QUOTEDVALS=""
for VAL in "${@}"; do
- if [ \! "$QUOTEDVALS" = "" ]; then
+ if [ ! "$QUOTEDVALS" = "" ]; then
QUOTEDVALS="${QUOTEDVALS} "
fi
QUOTEDVALS="${QUOTEDVALS}\"${VAL}\""