Example: ClearJavaError method

This script catches an error while trying to get a specific Java class. After the error is reported by the message box, then all JavaErrors are cleared using ClearJavaError.

Dim myClass As JavaClass
Dim myObject As JavaObject
Dim myError As JavaError

On Error GoTo Catch
Set mySession = new JavaSession()
Set myClass = mySession.GetClass("Invalid")
exit Sub

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