Deployable archive data is extracted from the JAR file with
no separate deployable archive or
folder
needed on the target machine. This behavior is helpful when storage
space on a file system is limited. packageName
mcr
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 CtfSource
or ExtractLocation
instantiation
options to customize how to manage deployable archive content with MWComponentOptions
:
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
type extending MWCtfSource
:
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 MWCtfSource
.
MWCtfFileSource
— Indicates
that the deployable archive data resides within a particular file
location that you specify. This class takes a java.io.File
object
in its constructor.
MWCtfDirectorySource
— Indicates
a folder to be scanned when instantiating the component: if a file
with a .ctf
suffix is found in the folder you supply,
the deployable archive bits are loaded from that file. This class
takes a 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 java.io.InputStream
object
in its constructor.
ExtractLocation
— This option
specifies where the extracted deployable archive content is to be
located. Since the MATLAB® Runtime requires all deployable archive
content be located somewhere on your file system, use the desired ExtractLocation
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.io.File
or 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:
MWCtfExtractLocation.EXTRACT_TO_CACHE
—
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 and forward.
—
Use when you want to locate the JAR or MWCtfExtractLocation.EXTRACT_TO_COMPONENT_DIR
.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 releases.
Note:
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:
getCtfSource()
setCtfSource()
Use the following methods to get or set the location where the extracted deployable archive content is to be located:
getExtractLocation()
setExtractLocation()
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 MWComponentOptions
using
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.
Environment Variable | Purpose | Notes |
---|---|---|
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. | Does not apply |
MCR_CACHE_VERBOSE | When set to any value, this variable prints logging details about the component cache for diagnostic reasons. This can be very helpful if problems are encountered during deployable archive extraction. | Logging details are turned off by default (for example, when this variable has no value). |
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 .max_size , which resides in
the file designated by running the mcrcachedir command,
with the desired cache size limit. |
To extract the deployable archive, compile using the -C
option
when calling mcc
.
You can also implement this override by entering -C
in
the Settings editor of the Library Compiler
app.
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.