Reputation: 732
I am trying to call a MATLAB function from Java, using Eclipse. I am using MATLAB R2018b (the trial version), JDK 11.0.1, and Eclipse 2018-09. Both MATLAB and Eclipse are 64 bit versions. I am on a Windows 64 bit machine.
I am using the MatlabEngine
, as per this example:
https://uk.mathworks.com/help/matlab/matlab_external/execute-matlab-functions-from-java.html
If I try to run the following code snippet (copied verbatim from the above link) from my main
method
MatlabEngine eng = MatlabEngine.startMatlab();
double[] a = {2.0, 4.0, 6.0};
double[] roots = eng.feval("sqrt", a);
for (double e : roots) {
System.out.println(e);
}
eng.close();
... I get the following error:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000005700000b95, pid=11028, tid=11252
#
# JRE version: Java(TM) SE Runtime Environment (11.0.1+13) (build 11.0.1+13-LTS)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0.1+13-LTS, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# v ~StubRoutines::atomic_add_long
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# F:\research\software\code\eclipse_workspace\tests\hs_err_pid11028.log
Could not load hsdis-amd64.dll; library not loadable; PrintAssembly is disabled
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
I tried Googling the error message, but to no avail. What is going on here?
Upvotes: 1
Views: 576
Reputation: 11
I recently had this exact error (but with Matlab R2020b). For anyone still interested, swiching the runtime JRE from JDK11 to JDK-8.0.275.1 solved the problem.
Upvotes: 1