| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB Builder JA |
| Contents | Index |
| Learn more about MATLAB Builder JA |
| On this page… |
|---|
As of R2007b, CTF data is now automatically extracted directly from the JAR file with no separate CTF or componentnamemcr folder needed on the target machine. This behavior is helpful when storage space on a file system is limited.
If you don't want to use this feature, use the MWComponentOptions class to specify how the MATLAB Builder JA product handles CTF data extraction and utilization.
Choose from the following CtfSource or ExtractLocation instantiation options to customize how the MATLAB Builder JA product manages CTF content with MWComponentOptions:
CtfSource — This option specifies where the CTF file may be found for an extracted component. It defines a binary data stream comprised of the bits of the CTF file. The following values are objects of some type extending MWCtfSource:
MWCtfSource.NONE — Indicates that no CTF file is to be extracted. This implies that the extracted CTF data is already accessible somewhere on your file system. This is a public, static, final instance of MWCtfSource.
MWCtfFileSource — Indicates that the CTF 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 CTF archive bits are loaded from that file. This class takes a java.io.File object in its constructor.
MWCtfStreamSource — Allows CTF 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 CTF content is to be located. Since the MCR requires all CTF 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 CTF content is to be placed in the MCR component cache. This is the default setting for R2007a and forward (see How Does the MATLAB Builder JA Product Use JAR Files?).
MWCtfExtractLocation.EXTRACT_TO_COMPONENT_DIR — 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 CTF data is extracted into the same folder. This option most closely matches the behavior of R2007a and previous releases.
Use the following methods to get or set the location where the CTF archive may be found for an extracted component:
getCtfSource()
setCtfSource()
Use the following methods to get or set the location where the extracted CTF content is to be located:
getExtractLocation()
setExtractLocation()
If you want to enable the MCR Component Cache for a Java component (in this example, using the user-built Java class MyModel) utilizing CTF content already resident in your file system, instantiate MWComponentOptions using the following statements:
MWComponentOptions options = new MWComponentOptions();
// set options for the component by calling setter methods
// on ‘options'
options.setCtfSource(MWCtfSource.NONE);
options.setExtractLocation(
new MWCtfExtractLocation("C:\\readonlydir\\MyModel_mcr"));
// instantiate the component using the desired options
MyModel m = new MyModel(options);
![]() | Ensuring Multi-Platform Portability | Learning About Java Classes and Methods by Exploring the Javadoc | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |