| 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… |
|---|
What Run-Time Options Can You Specify? Setting and Retrieving MCR Option Values Using MWApplication |
As of R2009a, you can pass MCR run-time options -nojvm, -nodisplay, and -logfile to MATLAB Builder JA from the client application using two classes in javabuilder.jar:
MWApplication
MWMCROption
The MWApplication class provides several static methods to set MCR option values and also to retrieve them. The following table lists static methods supported by this class.
| MWApplication Static Methods | Purpose |
|---|---|
| MWApplication.initializeApplication(MWMCROption... options); | Passes MCR options (see Specifying Run-Time Options Using MWMCROption) |
| MWApplication.isMCRInitialized(); | Returns true if MCR is initialized; otherwise returns false |
| MWApplication.isMCRJVMEnabled(); | Returns true if MCR is launched with JVM; otherwise returns false |
| MWApplication.isMCRNoDisplaySet(); | Returns true if MWMCROption.NODISPLAY is
used in MWApplication. initializeApplication |
| MWApplication.getMCRLogfileName(); | Retrieves the name of the log file |
MWApplication.initializeApplication takes zero or more MWMCROptions.
Calling MWApplication.initializeApplication() without any inputs launches the MCR with the following default values.
You must call MWApplication.initializeApplication() before performing any other processing.
These options are all write-once, read-only properties.
| MCR Run-Time Option | Default Values |
|---|---|
| -nojvm | false |
| -logfile | null |
| -nodisplay | false |
Note If there are no MCR options being passed, you do not need to use MWApplication.initializeApplication since initializing a MATLAB Builder JA component initializes the MCR with default options. |
Use the following static members of MWMCROption to represent the MCR options you want to modify.
| MWMCROption Static Members | Purpose |
|---|---|
| MWMCROption.NOJVM | Launches the MCR without a Java Virtual Machine (JVM). When this option is used, the JVM launched by the client application is unaffected. The value of this option determines whether or not the MCR should attach itself to the JVM launched by the client application. |
| MWMCROption.NODISPLAY | Launches the MCR without display functionality. |
| MWMCROption.logFile ("logfile.dat") | Allows you to specify a log file name (must be passed with a log file name). |
Example: Passing and Retrieving MCR Option Values from a Java Application. Following is an example of how MCR option values are passed and retrieved from a client-side Java application:
MWApplication.initializeApplication(MWMCROption.NOJVM,
MWMCROption.logFile("logfile.dat"),MWMCROption.NODISPLAY);
System.out.println(MWApplication.getMCRLogfileName());
System.out.println(MWApplication.isMCRInitialized());
System.out.println(MWApplication.isMCRJVMEnabled());
System.out.println(MWApplication.isMCRNoDisplaySet()); //UNIX
//Following is the initialization
// of MATLAB Builder JA
// component
myclass cls = new myclass();
cls.hello();
![]() | Improving Data Access Using the MCR User Data Interface and MATLAB Builder JA | Handling Data Conversion Between Java and MATLAB | ![]() |

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 |