It’s the same on Linux - it’s Windows that behaves oddly!
You have potentially two things to deal with - finding the directory of your launcher and traversing symlinks to the actual executable script.

Sigh. This would be so much easier to figure out if I actually had a Mac… Is there any significant difference between how shell scripts behave on Linux and Mac?
Like I said, the NetBeans launcher script works on both. I just looked for an old shell script launcher I had to handle this and it has an identical start to the NetBeans launcher script (pretty sure I got it from a website somewhere), but anyway …
#!/bin/bash
PRG=$0
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
if expr "$link" : '^/' 2> /dev/null >/dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
progdir=`dirname "$PRG"`
At the end of that, progdir contains the directory holding your actual launcher script. My old script called cd “$progdir”, but you would probably be better working with absolute paths from then.
eg. something like IIRC
"${progdir}/jre/bin/java" ARGS