#!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
JAR="$DIR/Workstation4ad3s-3.0.27.jar"
echo "Starting Workstation4ad3s..."
echo "Please wait up to 1 minute for the application to open."
echo ""
# 1) Bundled JRE
[ -x "$DIR/jre/bin/java" ] && exec "$DIR/jre/bin/java" -jar "$JAR"
# 2) JAVA_HOME
[ -n "$JAVA_HOME" ] && [ -x "$JAVA_HOME/bin/java" ] && exec "$JAVA_HOME/bin/java" -jar "$JAR"
# 3) PATH
command -v java >/dev/null 2>&1 && exec java -jar "$JAR"
echo "============================================================"
echo " Java not found."
echo " Either: put JRE into jre/ folder next to this script"
echo " Or:     set JAVA_HOME environment variable to point to JDK/JRE"
echo " See README.md for details."
echo "============================================================"
exit 1