You can pass MATLAB® Runtime options -nojvm
, -nodisplay
,
and -logfile
to MATLAB Compiler SDK™ from the
client application using two classes in javabuilder.jar
:
MWApplication
MWMCROption
The MWApplication
class provides several
static methods to set MATLAB Runtime option values and also to
retrieve them. The following table lists static methods supported
by this class.
MWApplication Static Methods | Purpose | |
---|---|---|
MWApplication.initialize(MWMCROption... | Passes MATLAB Runtime run-time options (see Specifying Run-Time Options Using MWMCROption) | |
MWApplication.isMCRInitialized(); | Returns true if the MATLAB Runtime run-time
is initialized; otherwise returns false | |
MWApplication.isMCRJVMEnabled(); | Returns true if the MATLAB Runtime run-time
is launched with JVM; otherwise returns false | |
MWApplication.isMCRNoDisplaySet(); | Returns true if MWMCROption.NODISPLAY is
used in MWApplication.initialize
| |
MWApplication.getMCRLogfileName(); | Retrieves the name of the log file |
MWApplication.initialize
takes zero or more MWMCROption
s.
Calling MWApplication.initialize()
without
any inputs launches the MATLAB Runtime with the following default
values.
You must call MWApplication.initialize()
before
performing any other processing.
These options are all write-once, read-only properties.
MATLAB Runtime Run-Time Option | Default Values |
---|---|
-nojvm | false |
-logfile | null |
-nodisplay | false |
Note:
If there are no MATLAB Runtime options being passed, you
do not need to use |
Use the following static members of MWMCROption
to
represent the MATLAB Runtime options you want to modify.
MWMCROption Static Members | Purpose |
---|---|
MWMCROption.NOJVM | Launches the MATLAB Runtime without a 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 MATLAB Runtime should attach itself to the JVM launched by the client application. |
MWMCROption.NODISPLAY | Launches the MATLAB Runtime without display functionality. |
MWMCROption.logFile(" | Allows you to specify a log file name (must be passed with a log file name). |
Passing and Retrieving MATLAB Runtime Option Values from a Java Application. Following is an example of how MATLAB Runtime option values are passed and retrieved from a client-side Java® application:
MWApplication.initialize(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 myclass cls = new myclass(); cls.hello();