The error you are seeing, and the definition of JavaLaunchServer, is not the root cause of the crash.
The cause of the crash is that Mac requires the shell's stack size to be a multiple of 4KB, but the emacs shell uses a nonstandard default stack size. MATLAB does not correct this when launched from inside emacs, and this then leads to this error.
A workaround for this is to set the default stack size within the emacs shell that launches MATLAB to a multiple of 4K:
1. create a file named matlab_emacs_wrapper with the following content:
#!/bin/bash
shell_stack_size=$(ulimit -s)
- round stack size to next 4K boundary:
adjusted_stack_size=$[4*((($shell_stack_size-1)/4)+1)]
ulimit -s $adjusted_stack_size && matlab $@
2. add the following to your .emacs file, after loading matlab-emacs:
(customize-set-variable 'matlab-shell-command "matlab_emacs_wrapper")
After that, running matlab-shell and other commands from inside matlab-emacs should get the correct stack size.
However, if you are launching MATLAB from emacs directly, please launch matlab_emacs_wrapper instead.
Best Answer