Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB Builder JA   

Dynamically Specifying Run-Time Options to the MCR

What Run-Time Options Can You Specify?

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:

Setting and Retrieving MCR Option Values Using MWApplication

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 MethodsPurpose
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

    Note   false is always returned on Windows systems since the -nodisplay option is not supported on Windows systems.

MWApplication.getMCRLogfileName();Retrieves the name of the log file

Specifying Run-Time Options Using MWMCROption

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 OptionDefault Values
-nojvmfalse
-logfilenull
-nodisplayfalse

Use the following static members of MWMCROption to represent the MCR options you want to modify.

MWMCROption Static MembersPurpose
MWMCROption.NOJVMLaunches 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();
  


Recommended Products

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