com.mathworks.runtime.ApplicationMode
Java enum that specifies the process mode for MATLAB Runtime instance creation
Since R2026a
Description
The ApplicationMode enum determines whether a MATLAB® Runtime instance operates within the same process as the Java® application or runs in a separate child process.
Enum Values
IN_PROCESS | Creates the MATLAB Runtime instance in the same process as the Java application. |
OUT_OF_PROCESS | Creates the MATLAB Runtime instance in a separate child process. |
Example
public class Example {
public static void main(String[] args) {
String ctfPath = "C:/path/to/your/ctf";
// Start MATLAB Runtime in the same process
try (MatlabRuntime runtime = MatlabRuntime.startMatlab(ctfPath, ApplicationMode.IN_PROCESS)) {
// Runtime operations here
System.out.println("MATLAB Runtime started in-process");
} catch (MatlabNotAvailableException | InterruptedException |
IllegalArgumentException | IllegalStateException e) {
System.out.println("Error with in-process MATLAB Runtime: " + e.getMessage());
}
// Start MATLAB Runtime in a separate process
try (MatlabRuntime runtime = MatlabRuntime.startMatlab(ctfPath, ApplicationMode.OUT_OF_PROCESS)) {
// Runtime operations here
System.out.println("MATLAB Runtime started out-of-process");
} catch (MatlabNotAvailableException | InterruptedException |
IllegalArgumentException | IllegalStateException e) {
System.out.println("Error with out-of-process MATLAB Runtime: " + e.getMessage());
}
}
}Version History
Introduced in R2026a