External Interfaces/API Reference    
usejava

Determine if a Java feature is supported in MATLAB

Syntax

Description

usejava(feature) returns 1 if the specified feature is supported and 0 otherwise. Possible feature arguments are shown in the following table.

Feature
Description
'awt'
Abstract Window Toolkit components1 are available
'desktop'
The MATLAB interactive desktop is running
'jvm'
The Java Virtual Machine is running
'swing'
Swing components2 are available

1. Java's GUI components in the Abstract Window Tookit

2. Java's lightweight GUI components in the Java Foundation Classes

Examples

The following conditional code ensures that the AWT's GUI components are available before the M-file attempts to display a Java Frame.

The next example is part of an M-file that includes Java code. It fails gracefully when run in a MATLAB session that does not have access to a JVM.

See Also

javachk


  methodsview  COM Functions