tf = usejava(feature) returns
logical 1 (true) if the specified
feature is supported. Otherwise, it returns logical 0 (false).
If the Java® feature is unavailable, then you can use this function
for error handling.
Use the following code snippet to test that
the AWT GUI components are available before attempting to display
a Java Frame. If the AWT is not available on your system, MATLAB® displays
the message Unable to open a Java Frame.
if usejava('awt')
myFrame = java.awt.Frame;
else
disp('Unable to open a Java Frame')
end
Call error Function
Use the following code snippet to terminate
a script if MATLAB does not have access to JVM® software.
The variable, filename, is a function
that contains Java code.
if ~usejava('jvm')
error([filename ' requires Java to run.'])
end
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.