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 clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
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.