| MATLAB® Builder™ JA | |
mcc [- W | - S] 'java:component_name,class_name,
file1[file2...fileN]
[class{class_name:file1 [,file2,...,fileN]},...]
[-d output_dir_path]
mcc - B 'bundlefile'[:arg1, arg2, ..., argN],
Use the mcc command to invoke the MATLAB Compiler product either from the MATLAB® command prompt (MATLAB mode) or the DOS or UNIX® command line (standalone mode).
mcc prepares M-file(s) for deployment outside of the MATLAB environment.
Note For a complete list of all mcc command options, see mcc in the MATLAB Compiler User's Guide documentation. |
The -W option is used when running mcc with the MATLAB® Builder™ JA product to create a class encapsulating one or more M-files.
| -W String Elements | Description |
|---|---|
| java: | Keyword that tells the compiler the type of component to create, followed by a colon. Specify java: to create a Java™ component. |
| component_name | Specifies the name of the component and its namespace, which is a period-separated list, such as companyname.groupname.component. |
| class_name | Specifies the name of the Java class to be created. The
default class_name is the last item in
the list specified as component_name. file1 [file2...fileN] are M-files to be encapsulated as methods in class_name. |
| [class{class_name:file1 [,file2,...,fileN]},...] | Optional. Specifies additional classes that you want to include in the component. To use this option, you specify the class name, followed by a colon, and then the names of the files you want to include in the class. You can include this multiple times to specify multiple classes. |
| [-d output_dir_path] | Optional. Tells the builder to create a directory and copy the output files to it. If you use mcc instead of the Deployment Tool, the project_directory\src and project_directory\distrib directories are not automatically created. |
Note The -S option lets you control how each Java class uses the MCR. It tells the builder to create a single MCR when the first Java class is instantiated. This MCR is reused and shared among all subsequent class instances within the component, resulting in more efficient memory usage and eliminating the MCR startup cost in each subsequent class instantiation. By default, a new MCR instance is created for each instance of each Java class in the component. Use -S to change the default. When using -S, note that all class instances share a single MATLAB workspace and share global variables in the M-files used to build the component. This makes properties of a Java class behave as static properties instead of instance-wise properties. |
The -B option is used to simplify the command-line input.
The -B option tells the builder to replace a specified file with the command-line information it contains.
| -B String Elements | Description |
|---|---|
| java: | Keyword that tells the compiler the type of component to create, followed by a colon. Specify java: to create a Java component. |
| bundlefile | Specifies the name of the file containing predefined component and class information. |
| [:arg1, arg2, ..., argN] | Files or other arguments used by the bundlefile. |
mcc -W 'java:com.mycompany.mycomponent,myclass'
foo.m bar.mThe example creates a Java component that has a fully qualified package name, com.mycompany.mycomponent. The component contains a single Java class, myclass, which contains methods foo and bar.
To use myclass, place the following statement in your code:
import com.mycompany.mycomponent.myclass;
mcc -W 'java:com.mycompany.mycomponent,myclass'
foo.m bar.m class{myclass2:foo2.m,bar2.m}
The example creates a Java component named mycomponent with two classes:
| myclass has methods foo and bar. |
| myclass2 has methods foo2 and bar2. |
Suppose myoptions file contains
-W 'java:mycomponent,myclass'
In this case,
mcc -B 'myoptions' foo.m bar.m
produces the same results as
mcc -W 'java:[mycomponent,myclass]' foo.m bar.m
mcc -S 'java:mycomponent,myclass' foo.m bar.m
The example creates a Java component called mycomponent containing a single Java class named myclass with methods foo and bar. (See the first example in this table).
If and when multiple instances of myclass are instantiated in an application, only one MCR is initialized, and it is shared by all instances of myclass.
Note All of these command-line examples produce the mycomponent.jar file (component jar file) Notice that the component name used to create these files is derived from the last item on the period-separated list that specifies the fully qualified name of the class. |
![]() | deploytool |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |