I'm using MATLAB Engine API for Java, so far basics such as eval and feval functions work without a problem. I even drew an histogram with those. But PutVariable method causes me to have "EXCEPTION_ACCESS_VIOLATION".
Code is:
package connecter;
import java.util.*;
import java.util.concurrent.ExecutionException;
import com.mathworks.engine.*;
public class MainClass {
public static void main(String[] args) throws IllegalArgumentException, IllegalStateException, InterruptedException, MatlabExecutionException, MatlabSyntaxException, ExecutionException {
MatlabEngine matEng = MatlabEngine.startMatlab();
matEng.putVariable("x", 3.0);
}
Console gives me the following:
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000001b224d20b95, pid=1904, tid=8768
#
# JRE version: Java(TM) SE Runtime Environment (12.0.2+10) (build 12.0.2+10)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (12.0.2+10, mixed mode, sharing, 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:
# [Filepath]\hs_err_pid1904.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
#
So far I've searched through countless threads but nothing has worked so far. I'm using JavaSE-12 and MATLAB is R2019b.