#!/usr/bin/env sh
set -eu

SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
ROOT_DIR=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
JAR_PATH="$ROOT_DIR/dist/Saleculator.jar"

if [ ! -f "$JAR_PATH" ]; then
  echo "Missing $JAR_PATH. This runtime package is incomplete; reinstall or replace it with a validated package." >&2
  exit 1
fi

cd "$ROOT_DIR"
exec java -Ddirname.path="$ROOT_DIR" -cp "$ROOT_DIR/lib/*:$JAR_PATH" com.posics.pos.forms.StartPOS "$@"
