Main Content

Avoid Calling Java main Methods in MATLAB

When calling a main method from MATLAB®, the method returns when it executes its last statement, even if the method creates a thread that is still executing. In other environments, the main method does not return until the thread completes execution.

Be cautious when calling main methods from MATLAB, particularly main methods that start a user interface. main methods are written assuming they are the entry point to application code. When called from MATLAB, main is not the entry point, and the fact that other Java® UI code might be already running can lead to problems.