1

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?

3
  • Did you try reading F:\research\software\code\eclipse_workspace\tests\hs_err_pid11028.log? Commented Dec 20, 2018 at 22:01
  • @ElliottFrisch I did - it starts with the same error message, and then continues with a lot of detail in which I get lost. Commented Dec 20, 2018 at 22:18
  • I can confirm that this also happens on IntelliJ 2018.3.2 x64 (i.e. it's not an Eclipse-specific issue). Win 10 and R2018b here. This might be related. Commented Dec 24, 2018 at 9:23

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.