External Interfaces/API |
Loading Java Class Definitions
Normally, MATLAB loads a Java class automatically when your code first uses it, (for example, when you call its constructor). However, there is one exception that you should be aware of.
When you use the which
function on methods defined by Java classes, the function only acts on the classes currently loaded into the MATLAB working environment. In contrast, which
always operates on MATLAB classes, whether or not they are loaded.
Determining Which Classes Are Loaded
At any time during a MATLAB session, you can obtain a listing of all the Java classes that are currently loaded. To do so, you use the inmem
function, in the following form.
This function returns the list of Java classes in output argument J
. (It also returns in M
the names of all currently loaded M-files, and in X
the names of all currently loaded MEX-files.)
Here's a sample of output from the inmem
function.
[m,x,j] = inmem m = 'isequal' 'isunix' 'fullfile' 'filesep'.
.
.
'matlabrc' x = 'getprofl' j = 'java.awt.Frame' 'com.mathworks.ide.desktop.MLDesktop'
Making Java Classes Available to MATLAB | Simplifying Java Class Names |