bin/isabelle_java
author wenzelm
Thu, 08 Apr 2021 13:09:44 +0200
changeset 60187 751b8a13c271
parent 59606 c3925099d59f
permissions -rwxr-xr-x
proper setup for "Doc" sessions;
avoid overlap of split sessions with old "Doc" session;
wneuper@59324
     1
#!/usr/bin/env bash
wneuper@59324
     2
#
wneuper@59324
     3
# Author: Makarius
wneuper@59324
     4
#
wneuper@59324
     5
# Isabelle/Java cold start -- without settings environment
wneuper@59324
     6
wneuper@59324
     7
if [ -L "$0" ]; then
wneuper@59324
     8
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
wneuper@59324
     9
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
wneuper@59324
    10
fi
wneuper@59324
    11
wneuper@59324
    12
export ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
wneuper@59324
    13
wneuper@59324
    14
(
wneuper@59324
    15
  source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
wneuper@59324
    16
wneuper@59451
    17
  eval "declare -a JAVA_ARGS=($ISABELLE_JAVA_SYSTEM_OPTIONS $ISABELLE_TOOL_JAVA_OPTIONS)"
wneuper@59324
    18
wneuper@59324
    19
  if [ -f "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar" ]; then
wneuper@59324
    20
    classpath "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar"
wneuper@59324
    21
  fi
wneuper@59324
    22
wneuper@59324
    23
  [ -n "$CLASSPATH" ] && classpath "$CLASSPATH"
wneuper@59324
    24
wneuper@59324
    25
  echo "$ISABELLE_ROOT"
wneuper@59324
    26
  echo "$CYGWIN_ROOT"
wneuper@59324
    27
  echo "$JAVA_HOME"
wneuper@59324
    28
  echo "$(platform_path "$ISABELLE_CLASSPATH")"
wneuper@59324
    29
  for ARG in "${JAVA_ARGS[@]}"; do echo "$ARG"; done
wneuper@59324
    30
) | {
wneuper@59324
    31
  LINE_COUNT=0
wneuper@59324
    32
  export ISABELLE_ROOT=""
wneuper@59324
    33
  export CYGWIN_ROOT=""
wneuper@59324
    34
  unset JAVA_HOME
wneuper@59324
    35
  unset ISABELLE_CLASSPATH
wneuper@59324
    36
  unset JAVA_ARGS; declare -a JAVA_ARGS
wneuper@59324
    37
wneuper@59324
    38
  while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
wneuper@59324
    39
  do
wneuper@59324
    40
    case "$LINE_COUNT" in
wneuper@59324
    41
      0)
wneuper@59324
    42
        LINE_COUNT=1
wneuper@59324
    43
        ISABELLE_ROOT="$REPLY"
wneuper@59324
    44
        ;;
wneuper@59324
    45
      1)
wneuper@59324
    46
        LINE_COUNT=2
wneuper@59324
    47
        CYGWIN_ROOT="$REPLY"
wneuper@59324
    48
        ;;
wneuper@59324
    49
      2)
wneuper@59324
    50
        LINE_COUNT=3
wneuper@59324
    51
        JAVA_HOME="$REPLY"
wneuper@59324
    52
        ;;
wneuper@59324
    53
      3)
wneuper@59324
    54
        LINE_COUNT=4
wneuper@59324
    55
        ISABELLE_CLASSPATH="$REPLY"
wneuper@59324
    56
        ;;
wneuper@59324
    57
      *)
wneuper@59324
    58
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$REPLY"
wneuper@59324
    59
        ;;
wneuper@59324
    60
    esac
wneuper@59324
    61
  done
wneuper@59324
    62
wneuper@59324
    63
  if [ -z "$JAVA_HOME" ]; then
wneuper@59324
    64
    echo "Unknown JAVA_HOME -- Java unavailable" >&2
wneuper@59324
    65
    exit 127
wneuper@59324
    66
  else
wneuper@59324
    67
    unset ISABELLE_HOME
wneuper@59324
    68
    unset CLASSPATH
wneuper@59451
    69
    exec "$JAVA_HOME/bin/java" "${JAVA_ARGS[@]}" \
wneuper@59451
    70
      -classpath "$ISABELLE_CLASSPATH" "$@"
wneuper@59324
    71
  fi
wneuper@59324
    72
}