I agree with pan64: the place where you should manage exceptions is inside the program, not using bash.
Given this, I think you can detect whether an exception occurred during program execution if you search for the word "Exception" in stderr output:
Code:
TEMPFILE=`mktemp`
java ..... 2>"$TEMPFILE"
if [ `grep 'Exception' "$TEMPFILE"` ]
then
# An exception occurred. You could read which one in the first line of the $TEMPFILE file
fi
rm "$TEMPFILE"