bin/isabelle_java
author desharna
Thu, 17 Jun 2021 10:46:27 +0200
changeset 73857 a88427e55371
parent 73705 ac07f6be27ea
permissions -rwxr-xr-x
shortened long lines
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63995
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     2
#
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     4
#
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     5
# Isabelle/Java cold start -- without settings environment
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     6
73705
ac07f6be27ea avoid unexpected output+behaviour when CDPATH is set
kleing
parents: 69126
diff changeset
     7
unset CDPATH
ac07f6be27ea avoid unexpected output+behaviour when CDPATH is set
kleing
parents: 69126
diff changeset
     8
63995
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     9
if [ -L "$0" ]; then
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    10
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    11
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    12
fi
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    13
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    14
export ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    15
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    16
(
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    17
  source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    18
66906
03a96b8c7c06 updated to jdk-8u152, which is for x86_64 only;
wenzelm
parents: 64035
diff changeset
    19
  eval "declare -a JAVA_ARGS=($ISABELLE_JAVA_SYSTEM_OPTIONS $ISABELLE_TOOL_JAVA_OPTIONS)"
63995
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    20
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    21
  if [ -f "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar" ]; then
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    22
    classpath "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    23
  fi
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    24
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    25
  [ -n "$CLASSPATH" ] && classpath "$CLASSPATH"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    26
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    27
  echo "$ISABELLE_ROOT"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    28
  echo "$CYGWIN_ROOT"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    29
  echo "$JAVA_HOME"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    30
  echo "$(platform_path "$ISABELLE_CLASSPATH")"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    31
  for ARG in "${JAVA_ARGS[@]}"; do echo "$ARG"; done
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    32
) | {
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    33
  LINE_COUNT=0
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    34
  export ISABELLE_ROOT=""
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    35
  export CYGWIN_ROOT=""
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    36
  unset JAVA_HOME
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    37
  unset ISABELLE_CLASSPATH
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    38
  unset JAVA_ARGS; declare -a JAVA_ARGS
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    39
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    40
  while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    41
  do
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    42
    case "$LINE_COUNT" in
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    43
      0)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    44
        LINE_COUNT=1
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    45
        ISABELLE_ROOT="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    46
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    47
      1)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    48
        LINE_COUNT=2
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    49
        CYGWIN_ROOT="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    50
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    51
      2)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    52
        LINE_COUNT=3
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    53
        JAVA_HOME="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    54
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    55
      3)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    56
        LINE_COUNT=4
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    57
        ISABELLE_CLASSPATH="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    58
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    59
      *)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    60
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    61
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    62
    esac
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    63
  done
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    64
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    65
  if [ -z "$JAVA_HOME" ]; then
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    66
    echo "Unknown JAVA_HOME -- Java unavailable" >&2
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    67
    exit 127
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    68
  else
64022
3c0193f82d20 clarified cold-start environment;
wenzelm
parents: 63995
diff changeset
    69
    unset ISABELLE_HOME
63995
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    70
    unset CLASSPATH
67490
982f0bf34804 more robust java.ext.dirs: avoid picking up accidental jars from system directories;
wenzelm
parents: 66906
diff changeset
    71
    exec "$JAVA_HOME/bin/java" "${JAVA_ARGS[@]}" \
982f0bf34804 more robust java.ext.dirs: avoid picking up accidental jars from system directories;
wenzelm
parents: 66906
diff changeset
    72
      -classpath "$ISABELLE_CLASSPATH" "$@"
63995
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    73
  fi
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    74
}