bin/isabelle_java
author nipkow
Thu, 24 May 2018 14:42:47 +0200
changeset 68261 035c78bb0a66
parent 67490 982f0bf34804
child 69126 e1b4b14ded58
permissions -rwxr-xr-x
reorganization, everything based on Tree2 now
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
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     7
if [ -L "$0" ]; then
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     8
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
     9
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    10
fi
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    11
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    12
export ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    13
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    14
(
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    15
  source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    16
66906
03a96b8c7c06 updated to jdk-8u152, which is for x86_64 only;
wenzelm
parents: 64035
diff changeset
    17
  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
    18
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    19
  if [ -f "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar" ]; then
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    20
    classpath "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    21
  fi
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    22
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    23
  [ -n "$CLASSPATH" ] && classpath "$CLASSPATH"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    24
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    25
  echo "$ISABELLE_ROOT"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    26
  echo "$CYGWIN_ROOT"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    27
  echo "$JAVA_HOME"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    28
  echo "$(platform_path "$ISABELLE_CLASSPATH")"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    29
  for ARG in "${JAVA_ARGS[@]}"; do echo "$ARG"; done
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    30
) | {
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    31
  LINE_COUNT=0
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    32
  export ISABELLE_ROOT=""
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    33
  export CYGWIN_ROOT=""
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    34
  unset JAVA_HOME
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    35
  unset ISABELLE_CLASSPATH
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    36
  unset JAVA_ARGS; declare -a JAVA_ARGS
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    37
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    38
  while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    39
  do
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    40
    case "$LINE_COUNT" in
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    41
      0)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    42
        LINE_COUNT=1
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    43
        ISABELLE_ROOT="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    44
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    45
      1)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    46
        LINE_COUNT=2
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    47
        CYGWIN_ROOT="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    48
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    49
      2)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    50
        LINE_COUNT=3
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    51
        JAVA_HOME="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    52
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    53
      3)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    54
        LINE_COUNT=4
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    55
        ISABELLE_CLASSPATH="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    56
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    57
      *)
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    58
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$REPLY"
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    59
        ;;
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    60
    esac
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    61
  done
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    62
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    63
  if [ -z "$JAVA_HOME" ]; then
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    64
    echo "Unknown JAVA_HOME -- Java unavailable" >&2
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    65
    exit 127
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    66
  else
64022
3c0193f82d20 clarified cold-start environment;
wenzelm
parents: 63995
diff changeset
    67
    unset ISABELLE_HOME
63995
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    68
    unset CLASSPATH
67490
982f0bf34804 more robust java.ext.dirs: avoid picking up accidental jars from system directories;
wenzelm
parents: 66906
diff changeset
    69
    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
    70
      "-Djava.ext.dirs=$JAVA_HOME/lib/ext" \
982f0bf34804 more robust java.ext.dirs: avoid picking up accidental jars from system directories;
wenzelm
parents: 66906
diff changeset
    71
      -classpath "$ISABELLE_CLASSPATH" "$@"
63995
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    72
  fi
2e4d80723fb0 added isabelle_java cold-start executable;
wenzelm
parents:
diff changeset
    73
}