#!/usr/bin/env bash

#see http://stackoverflow.com/questions/7665/how-to-resolve-symbolic-links-in-a-shell-script
SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
while [ -h "$SELF_PATH" ]; do
    DIR=$(dirname -- "$SELF_PATH")
    SYM=$(readlink "$SELF_PATH")
    SELF_PATH=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
done

exec java -jar "${SELF_PATH}.jar" -charset UTF-8 "$@"
