#!/bin/bash

# find Path to this script
FILE="${BASH_SOURCE[0]}"
while [ -h "$FILE" ] ; do
  SOURCE="$(readlink "$FILE")"
  FILE="$( cd -P "$(dirname "$FILE")" && \
           cd -P "$(dirname "$SOURCE")" && pwd )/$(basename "$SOURCE")"
done
BASEX_DIR="$( cd -P "$(dirname "$FILE")/.." && pwd )"

# Core and library classes
CP="$BASEX_DIR/BaseX.jar"
CP="$CP$(for jar in "$BASEX_DIR"/lib/*.jar; do echo -n ":$jar"; done)"

# Options for virtual machine
VM=-Xmx512m

# Run code
java -cp "$CP" $VM org.basex.api.BaseXHTTP "$@"
