Skip to content

Commit

Permalink
Fix macOS jdk8 path
Browse files Browse the repository at this point in the history
  • Loading branch information
jiachuan.zhu committed Jul 26, 2022
1 parent a639d2e commit 0d43658
Showing 1 changed file with 33 additions and 29 deletions.
62 changes: 33 additions & 29 deletions dev/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,33 +106,37 @@ then
export BYZER_SERVER_MODE="server"
fi

# set JAVA
if [[ "${JAVA}" == "" ]]; then
if [[ -z "$JAVA_HOME" ]]; then
if [[ ${BYZER_SERVER_MODE} == "all-in-one" ]]; then
# use embeded open jdk 8 in all-in-one
JAVA_HOME=${BYZER_HOME}/jdk8
elif [[ $(isValidJavaVersion) == "true" ]]; then
JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
else
quit "Java 1.8 or above is required."
fi
[[ -z "$JAVA_HOME" ]] && quit "Please set JAVA_HOME"
export JAVA_HOME
fi
export JAVA=$JAVA_HOME/bin/java
[[ -e "${JAVA}" ]] || quit "${JAVA} does not exist. Please set JAVA_HOME correctly."
verbose "java is ${JAVA}"
fi

# check Machine
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) os=Linux;;
Darwin*) os=Mac;;
CYGWIN*) os=Cygwin;;
MINGW*) os=MinGw;;
*) os="UNKNOWN:${unameOut}"
esac
export MACHINE_OS=$os
# check Machine
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) os=Linux;;
Darwin*) os=Mac;;
CYGWIN*) os=Cygwin;;
MINGW*) os=MinGw;;
*) os="UNKNOWN:${unameOut}"
esac
export MACHINE_OS=$os
# set JAVA
if [[ "${JAVA}" == "" ]]; then
if [[ -z "$JAVA_HOME" ]]; then
if [[ ${BYZER_SERVER_MODE} == "all-in-one" ]]; then
if [[ "Mac" == "${MACHINE_OS}" ]]
then
# use embedded open jdk 8 in all-in-one
JAVA_HOME=${BYZER_HOME}/jdk8/Contents/Home/
else
JAVA_HOME="${BYZER_HOME}"/jdk8
fi
elif [[ $(isValidJavaVersion) == "true" ]]; then
JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
else
quit "Java 1.8 or above is required."
fi
[[ -z "$JAVA_HOME" ]] && quit "Please set JAVA_HOME"
export JAVA_HOME
fi
export JAVA=$JAVA_HOME/bin/java
[[ -e "${JAVA}" ]] || quit "${JAVA} does not exist. Please set JAVA_HOME correctly."
verbose "java is ${JAVA}"
fi
fi

0 comments on commit 0d43658

Please sign in to comment.