JAL-3130 java bash wrapper to choose which java to run (if this is first in path...
authorBen Soares <bsoares@dundee.ac.uk>
Mon, 17 Dec 2018 10:37:13 +0000 (10:37 +0000)
committerBen Soares <bsoares@dundee.ac.uk>
Mon, 17 Dec 2018 10:37:13 +0000 (10:37 +0000)
j11jre/bin/java [new file with mode: 0755]

diff --git a/j11jre/bin/java b/j11jre/bin/java
new file mode 100755 (executable)
index 0000000..1fff2eb
--- /dev/null
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+OS=$(uname)
+
+[ -z $JRE_HOME ] && JRE_HOME=$JAVA_HOME
+BASE_DIR=$(dirname ${0})
+BASE_DIR=${BASE_DIR%/bin}
+
+if [ -z $JRE_HOME ]; then
+  case $OS in
+  Darwin) JRE_HOME=$BASE_DIR/openjdk11_macos ;;
+  Linux) JRE_HOME=$BASE_DIR/openjdk11_linux ;;
+  esac
+fi
+
+echo $JRE_HOME/bin/java ${@}
+$JRE_HOME/bin/java ${@}