| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
javachk(feature)
javachk(feature, component)
javachk(feature) returns a generic error message if the specified Java feature is not available in the current MATLAB session. If it is available, javachk returns an empty matrix. 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 software(JVM™) is running. |
'swing' | Swing components2 are available. |
1. Java GUI components in the Abstract Window Toolkit
2. Java lightweight GUI components in the Java Foundation Classes
javachk(feature, component) works the same as the above syntax, except that the specified component is also named in the error message. (See the example below.)
The following M-file displays an error with the message "CreateFrame is not supported on this platform." when run in a MATLAB session in which the AWT's GUI components are not available. The second argument to javachk specifies the name of the M-file, which is then included in the error message generated by MATLAB.
javamsg = javachk('awt', mfilename);
if isempty(javamsg)
myFrame = java.awt.Frame;
myFrame.setVisible(1);
else
error(javamsg);
end
![]() | javaArray | javaclasspath | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |