Hi Chris Rygaard,
I understand that you are trying to use MATLAB from JAVA through MATLAB Engine API and in some cases this is causing JVM to crash.
Follow the below troubleshooting steps to resolve the problem,
- Make sure the JAVA version is compatible with MATLAB. Refer the following MATLAB document to check the compatible versions, https://www.mathworks.com/support/requirements/language-interfaces.html
- Instead of using ‘variableFuture.get()’ try using ‘variableFuture.get(timeout, timeUnit)’ with a reasonable timeout value. This will help you identify if the issue is related to the retrieval process.
- Try to open the crash logs and see if you can locate the exact error for crashing. Refer the following document to locate crash files, https://www.mathworks.com/help/matlab/matlab_env/error-log-reporting.html
- Try to catch the following exceptions to see if you are encountering any expected exceptions, https://www.mathworks.com/help/matlab/matlab_external/trouble-shooting-matlab-engine-api-exceptions.html
- Make sure the syntax of expression that you are trying to evaluate using MATLAB is correct.
For more information on using MATLAB API from JAVA, refer the following MATLAB documentation,
- https://www.mathworks.com/help/matlab/matlab_external/get-started-with-matlab-engine-api-for-java.html
- https://www.mathworks.com/help/matlab/matlab-engine-api-for-java.html
- https://www.mathworks.com/help/matlab/matlab_external/java-api-summary.html
Hope this is helpful.