29 lines
622 B
Bash
Executable File

if ! command -v javac >/dev/null 2>&1; then
echo "Error: javac is not installed."
exit 1
fi
if ! command -v java >/dev/null 2>&1; then
echo "Error: java is not installed."
exit 1
fi
# build list of source files
find src -name "*.java" > sources.txt
echo "Main.java" >> sources.txt
# compile with all extern jars
if ! javac -d build -cp "extern/*" @sources.txt Main.java; then
echo "Error: javac failed to compile sources."
exit 1
fi
rm sources.txt
# create instance dir if not exists
if [ ! -d "instance" ]; then
mkdir instance
fi
# run with all extern jars
java -cp "build:extern/*" Main