--- a/usr/share/java/jtreg/bin/jtreg
+++ b/usr/share/java/jtreg/bin/jtreg
@@ -47,6 +47,10 @@
 #
 # jtreg also provides Ant tasks; see the documentation for details.
 
+_prog=$0
+_link=`readlink $_prog`
+[ -n "$_link" ] && _prog=$_link
+
 # Determine jtreg/JavaTest installation directory
 if [ -n "$JT_HOME" ]; then
     if [ ! -r $JT_HOME/lib/jtreg.jar ];then
@@ -58,11 +62,11 @@
     # - should work on most derivatives of Bourne shell, like ash, bash, ksh,
     #   sh, zsh, etc, including on Windows, MKS (ksh) and Cygwin (ash or bash)
     if type -p type 1>/dev/null 2>&1 && test -z "`type -p type`" ; then
-        myname=`type -p "$0"`
+        myname=`type -p "$_prog"`
     elif type type 1>/dev/null 2>&1 ; then
-        myname=`type "$0" | sed -e 's/^.* is a tracked alias for //' -e 's/^.* is //'`
+        myname=`type "$_prog" | sed -e 's/^.* is a tracked alias for //' -e 's/^.* is //'`
     elif whence whence 1>/dev/null 2>&1 ; then
-        myname=`whence "$0"`
+        myname=`whence "$_prog"`
     fi
     mydir=`dirname "$myname"`
     p=`cd "$mydir" ; pwd`
@@ -132,6 +136,6 @@
 
 "${JT_JAVA}" \
     $javaOpts \
-    -Dprogram=`basename "$0"` \
+    -Dprogram=`basename "$_prog"` \
     -jar "${JT_HOME}/lib/jtreg.jar" \
     $jtregOpts
