Example: JavaError class

This script will catch an error while trying to get a specific Java class. After the error is reported by the MessageBox, the JavaError is cleared using ClearJavaError.

Dim mySession As JavaSession
Dim myClass As JavaClass
Dim myError As JavaError

On Error GoTo Catch

Set mySession = new JavaSession()
Set myClass = mySession.GetClass("Invalid")
done:
exit sub

Catch:
Set myError = mySession.getLastJavaError()
MessageBox myError.errormsg,, "Error"
mySession.ClearJavaError
Resume done