Main Content

matlab.exception.JavaException Class

Namespace: matlab.exception

Capture error information for Java exception

Description

Process information from a matlab.exception.JavaException object to handle Java® errors thrown by Java methods called from MATLAB®. This class is derived from MException.

Creation

You do not construct a matlab.exception.JavaException object explicitly. MATLAB automatically constructs a JavaException object whenever Java throws an exception. The JavaException object wraps the original Java exception.

Properties

expand all

Java exception object that caused the error, specified as a java.lang.Throwable object.

Examples

collapse all

Add a matlab.exception.JavaException object to a try-catch statement.

try
    java.lang.Class.forName('myfunction');
catch e
    e.message
    if(isa(e,'matlab.exception.JavaException'))
        ex = e.ExceptionObject;
        assert(isjava(ex));
        ex.printStackTrace;
    end
end

Version History

Introduced in R2012b