This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

matlab.exception.JavaException class

Package: 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

Introduced in R2012b