Merge branch 'releases/Release_2_11_3_Branch'
[jalview.git] / utils / getdown / bin / jalview.sh
index 849d71a..90d1558 100755 (executable)
@@ -1,7 +1,6 @@
 #!/usr/bin/env bash
 
 declare -a ARGS=("${@}")
-ARG1=$1
 
 # this whole next part is because there's no readlink -f in Darwin
 function readlinkf() {
@@ -85,8 +84,14 @@ else
 fi
 
 if [ "${HEADLESS}" = 1 ]; then
-  # this suppresses the Java icon appearing in the macOS Dock and maybe other things in other OSes
-  JVMARGS=( "${JVMARGS[@]}" "-Djava.awt.headless=true" )
+  # not setting java.awt.headless in java invocation of running jalview due to problem with Jmol
+  if [ "${HELP}" = 1 ]; then
+    JVMARGS=( "${JVMARGS[@]}" "-Djava.awt.headless=true" )
+  fi
+  # this suppresses the Java icon appearing in the macOS Dock
+  if [ "${ISMACOS}" = 1 ]; then
+    JVMARGS=( "${JVMARGS[@]}" "-Dapple.awt.UIElement=true" )
+  fi
 fi
 
 SYSJAVA=java
@@ -163,8 +168,22 @@ if [ \! -e "${JAVA}" ]; then
   echo "Cannot find bundled java, using system ${JAVA} and hoping for the best!" >&2
 fi
 
+function quotearray() {
+  QUOTEDVALS=""
+  for VAL in "${@}"; do
+    if [ \! "$QUOTEDVALS" = "" ]; then
+      QUOTEDVALS="${QUOTEDVALS} "
+    fi
+    QUOTEDVALS="${QUOTEDVALS}\"${VAL}\""
+  done
+  echo $QUOTEDVALS
+}
+
+JVMARGSSTR=$(quotearray "${JVMARGS[@]}")
+ARGSSTR=$(quotearray "${ARGS[@]}")
+
 if [ "${DEBUG}" = 1 ]; then
- echo Shell running: \""${JAVA}"\" \""${JVMARGS[@]}"\" -cp \""${CLASSPATH}"\" jalview.bin.Launcher "${ARGS[@]}"
+ echo Shell running: \""${JAVA}"\" ${JVMARGSSTR} -cp \""${CLASSPATH}"\" jalview.bin.Launcher ${ARGSSTR}
 fi
 
 "${JAVA}" "${JVMARGS[@]}" -cp "${CLASSPATH}" jalview.bin.Launcher "${ARGS[@]}"