It sets the class path to the path of the .sh file in line 88 of the .sh file.
this_script=`which "$0" 2>/dev/null`
[ $? -gt 0 -a -f "$0" ] && this_script="$0"
cp=$this_script
[...]
CLASSPATH="$cp"
export CLASSPATH
There's no need to "unpack" the main class.
It uses a trick to combine a shell script and the actual JAR/ZIP data in a single file: It uses the fact that a ZIP file's central data structure is at its end. The zip/jar file reader simply about the "garbage data" shell script at the beginning.
Often the first thing in a zip file is a zip entry, which can be identified easily by its signature. But it is not necessarily the case that a zip file begins with a zip entry, and is not required by the zip specification.
As long as the shell script code exits before the actual zip/jar data starts, the shell doesn't care about the "garbage data" after the shell script part of the file either.