From 01d329e7853e2c9b35874f2fecada7fa1768afa5 Mon Sep 17 00:00:00 2001 From: "David W. Streever" Date: Wed, 23 Sep 2020 21:17:22 -0400 Subject: [PATCH] Support for JAVA_HOME and java opts via -D*. --- hive-sre/bin/hive-sre | 8 +++++++- hive-sre/bin/hive-sre-cli | 11 +++++++++-- hive-sre/pom.xml | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/hive-sre/bin/hive-sre b/hive-sre/bin/hive-sre index 8acde1f..e5293af 100755 --- a/hive-sre/bin/hive-sre +++ b/hive-sre/bin/hive-sre @@ -12,6 +12,11 @@ if [[ ! -d ${HOME}/.hive-sre/cust ]]; then mkdir -p ${HOME}/.hive-sre/cust fi +if [ ! -z ${JAVA_HOME} ]; then + JAVA="${JAVA_HOME}/bin/java" +else + JAVA=java +fi if [[ -f ./hive-sre && "${APP_DIR}" != "${CURR_DIR}" && "${APP_DIR}" != "." ]]; then echo "Appears you are referencing a previously installed 'hive-sre' while " @@ -112,7 +117,8 @@ if [[ "${PRG_ARGS}x" != "x" ]]; then echo "PRG_ARGS=${PRG_ARGS}" fi +$(${JAVA} -version) -CLI_CMD="${CLI_CMD}java -cp ${CMD_CP} ${APP_JAVA_OPTS} com.streever.hive.Sre ${PRG_ARGS}" +CLI_CMD="${JAVA} -cp ${CMD_CP} ${APP_JAVA_OPTS} com.streever.hive.Sre ${PRG_ARGS}" eval "${CLI_CMD}" diff --git a/hive-sre/bin/hive-sre-cli b/hive-sre/bin/hive-sre-cli index ee904ab..b46e10c 100755 --- a/hive-sre/bin/hive-sre-cli +++ b/hive-sre/bin/hive-sre-cli @@ -14,6 +14,12 @@ fi PRG_ARGS= CMD_CP= +if [ ! -z ${JAVA_HOME} ]; then + JAVA="${JAVA_HOME}/bin/java" +else + JAVA=java +fi + if [[ -f ./hive-sre-shaded.jar ]]; then # Look in Current Directory CMD_CP=$APP_DIR/hive-sre-shaded.jar @@ -37,7 +43,6 @@ fi export HADOOP_CONF_DIR="/etc/hadoop/conf" AUX_LIBS_DIR=${HADOOP_CLI_AUX_LIBS:-${HOME}/.hive-sre/aux_libs} - SHOW_CP= CMD_DIRECTIVE= CMD_ARGS= @@ -162,6 +167,8 @@ if [[ "${PRG_ARGS}x" != "x" ]]; then echo "PRG_ARGS=${PRG_ARGS}" fi -CLI_CMD="${CLI_CMD}java -cp ${CMD_CP} ${APP_JAVA_OPTS} com.streever.hadoop.HadoopShell ${PRG_ARGS}" +$(${JAVA} -version) + +CLI_CMD="${JAVA} -cp ${CMD_CP} ${APP_JAVA_OPTS} com.streever.hadoop.HadoopShell ${PRG_ARGS}" eval "${CLI_CMD}" diff --git a/hive-sre/pom.xml b/hive-sre/pom.xml index 569bb6d..d1a0b80 100644 --- a/hive-sre/pom.xml +++ b/hive-sre/pom.xml @@ -6,7 +6,7 @@ com.streever.hive hive-sre - 2.3.2.3-SNAPSHOT + 2.3.2.4-SNAPSHOT hive @@ -55,7 +55,7 @@ - 2.2.2.0-SNAPSHOT + 2.2.2.1-SNAPSHOT