bin/isabelle_java
changeset 63995 2e4d80723fb0
child 64022 3c0193f82d20
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/bin/isabelle_java	Sun Oct 02 17:05:48 2016 +0200
     1.3 @@ -0,0 +1,70 @@
     1.4 +#!/usr/bin/env bash
     1.5 +#
     1.6 +# Author: Makarius
     1.7 +#
     1.8 +# Isabelle/Java cold start -- without settings environment
     1.9 +
    1.10 +if [ -L "$0" ]; then
    1.11 +  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
    1.12 +  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
    1.13 +fi
    1.14 +
    1.15 +export ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
    1.16 +
    1.17 +(
    1.18 +  source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
    1.19 +
    1.20 +  declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_JAVA_SYSTEM_OPTIONS)"
    1.21 +
    1.22 +  if [ -f "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar" ]; then
    1.23 +    classpath "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar"
    1.24 +  fi
    1.25 +
    1.26 +  [ -n "$CLASSPATH" ] && classpath "$CLASSPATH"
    1.27 +
    1.28 +  echo "$ISABELLE_ROOT"
    1.29 +  echo "$CYGWIN_ROOT"
    1.30 +  echo "$JAVA_HOME"
    1.31 +  echo "$(platform_path "$ISABELLE_CLASSPATH")"
    1.32 +  for ARG in "${JAVA_ARGS[@]}"; do echo "$ARG"; done
    1.33 +) | {
    1.34 +  LINE_COUNT=0
    1.35 +  export ISABELLE_ROOT=""
    1.36 +  export CYGWIN_ROOT=""
    1.37 +  unset JAVA_HOME
    1.38 +  unset ISABELLE_CLASSPATH
    1.39 +  unset JAVA_ARGS; declare -a JAVA_ARGS
    1.40 +
    1.41 +  while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
    1.42 +  do
    1.43 +    case "$LINE_COUNT" in
    1.44 +      0)
    1.45 +        LINE_COUNT=1
    1.46 +        ISABELLE_ROOT="$REPLY"
    1.47 +        ;;
    1.48 +      1)
    1.49 +        LINE_COUNT=2
    1.50 +        CYGWIN_ROOT="$REPLY"
    1.51 +        ;;
    1.52 +      2)
    1.53 +        LINE_COUNT=3
    1.54 +        JAVA_HOME="$REPLY"
    1.55 +        ;;
    1.56 +      3)
    1.57 +        LINE_COUNT=4
    1.58 +        ISABELLE_CLASSPATH="$REPLY"
    1.59 +        ;;
    1.60 +      *)
    1.61 +        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$REPLY"
    1.62 +        ;;
    1.63 +    esac
    1.64 +  done
    1.65 +
    1.66 +  if [ -z "$JAVA_HOME" ]; then
    1.67 +    echo "Unknown JAVA_HOME -- Java unavailable" >&2
    1.68 +    exit 127
    1.69 +  else
    1.70 +    unset CLASSPATH
    1.71 +    exec "$JAVA_HOME/bin/java" "${JAVA_ARGS[@]}" -classpath "$ISABELLE_CLASSPATH" "$@"
    1.72 +  fi
    1.73 +}