Deployable archive data is extracted from the JAR file with
no separate deployable archive or
needed on the target machine. This behavior is helpful when storage
space on a file system is limited.
If you don't want deployable archive data extracted by default,
use either the
MWComponentOptions class, or use
environment variables, to specify how deployable archive data extraction
and utilization is handled.
Choose from the following
options to customize how to manage deployable archive content with
CtfSource — This option
specifies where the deployable archive may be found for an extracted
component. It defines a binary data stream comprised of the bits of
the deployable archive. The following values are objects of some
MWCtfSource.NONE — Indicates
that no deployable archive is to be extracted. This implies that
the extracted deployable archive data is already accessible somewhere
on your file system. This is a public, static, final instance of
MWCtfFileSource — Indicates
that the deployable archive data resides within a particular file
location that you specify. This class takes a
in its constructor.
MWCtfDirectorySource — Indicates
a folder to be scanned when instantiating the component: if a file
.ctf suffix is found in the folder you supply,
the deployable archive bits are loaded from that file. This class
java.io.File object in its constructor.
MWCtfStreamSource — Allows
deployable archive bits to be read and extracted directly from a specified
input stream. This class takes a
in its constructor.
ExtractLocation — This option specifies where
the extracted deployable archive content is to be located. Since MATLAB® Runtime requires all deployable archive content be located somewhere
on your file system, use the desired
option, along with the component type information, to define a unique
location. A value for this option is an instance of the class
MWCtfExtractLocation. An instance of this class can be
created by passing a
java.lang.String into the constructor to specify the
file system location to be used or one of these predefined, static final
instances may be used:
Use to indicate that the deployable archive content is to be placed in
the MATLAB Runtime component cache. This is the default setting for R2007a
— Use when you want to locate the JAR or
.class files from which the component has been
loaded. If the location is found (e.g., it is on the file system),
then the deployable archive data is extracted into the same folder.
This option most closely matches the behavior of R2007a and previous
Deployable archives are extracted by default to
Use the following methods to get or set the location where the deployable archive may be found for an extracted component:
Use the following methods to get or set the location where the extracted deployable archive content is to be located:
Enabling MATLAB Runtime Component Cache, Utilizing Deployable
Archive Content Already on Your System. If you want to enable the MATLAB Runtime Component Cache
for a generated Java® class utilizing deployable archive content
already resident in your file system, instantiate
the following statements:
MWComponentOptions options = new MWComponentOptions(); // set options for the class by calling setter methods // on 'options' options.setCtfSource(MWCtfSource.NONE); options.setExtractLocation( new MWCtfExtractLocation("C:\\readonlydir\\MyModel_mcr")); // instantiate the class using the desired options MyModel m = new MyModel(options);
Use the following environment variables to change these settings.
|MCR_CACHE_ROOT||When set to the location of where you want the deployable archive to be extracted, this
variable overrides the default per-user component cache location. This is true
for embedded ||On macOS, this variable is ignored in MATLAB R2020a and later. The app bundle contains the files necessary for runtime.|
|MCR_CACHE_SIZE||When set, this variable overrides the default component cache size.||The initial limit for this variable is 32M (megabytes). This
may, however, be changed after you have set the variable the first
time. Edit the file |
To extract the deployable archive, compile using the
You can also implement this override by entering
the Settings editor of the Library Compiler
You might want to use this option to troubleshoot problems with the deployable archive, for example, as the log and diagnostic messages are much more visible.
For more information about the deployable archive, see Deployable Archive.