Hauptinhalt

javachk

R2026b

Error message based on Java feature support

Description

MSG = javachk(feature) returns a generic error message if the specified Java® feature is not available in the current MATLAB® session.

example

javachk(feature,component) also names the specified component in the error message.

Examples

collapse all

To test if Java is available before calling a Java command, use these statements. The isempty function is true when there is no error.

if isempty(javachk("jvm"))
   scalar = java.lang.Double(5);
end

Input Arguments

collapse all

Java feature, specified as one of these values.

"awt"

UI components in the Java Abstract Window Toolkit (AWT) are available. To be removed.

"desktop"

MATLAB interactive desktop is running. To be removed.

"jvm"

Java Virtual Machine software (JVM®) is available.

"swing"

Swing components (Java lightweight UI components in the Java Foundation Classes) are available. To be removed.

Identifier, specified as a string or a character vector, to display in the error message.

Output Arguments

collapse all

Error message, returned as a structure with the following fields. If the feature is available, javachk returns an error structure with empty fields.

Message, specified as a character vector.

Identifier, specified as a character vector.

Version History

Introduced before R2006a

expand all

See Also

|