void-packages/srcpkgs/openjdk-common/files/java.sh
classabbyamp 0a643c793a openjdk-common: update to 2.
adds /usr/bin/java script to bridge the gap between fully profile-based
and fully /usr/bin symlinks
2024-01-06 17:05:04 -05:00

11 lines
427 B
Bash

#!/bin/sh
# allows scripts that assume java exists on PATH to work
# and helps users use java without logging out/in for the profile script
die() {
echo "java: $@" >&2
exit 1
}
. /etc/profile.d/jdk.sh
[ -d "$JAVA_HOME" ] || die "/usr/lib/jvm/default-jre not found. Check xbps-alternatives -lg java"
[ -x "$JAVA_HOME"/bin/java ] || die "$JAVA_HOME/bin/java does not exist or is not executable"
exec "$JAVA_HOME"/bin/java "$@"