I am trying to call MATLAB functions from Jetbrains MPS. However, I am getting this error:

Native Library /usr/local/MATLAB/R2017a/bin/glnxa64/libnativemvm.so already loaded in another classloader java.lang.UnsatisfiedLinkError: Native Library /usr/local/MATLAB/R2017a/bin/glnxa64/libnativemvm.so already loaded in another classloader

The code I am using is :

final String[] options = {"-noFigureWindows", "-r", "-cd"}; 
final MatlabEngine startMatlab; 
try { 
  startMatlab = MatlabEngine.startMatlab(options); 
  this.setMatLabReference(startMatlab); 
} catch (Exception ex) { 
  System.out.println("Exception" + ex.toString()); 
}

Thanks in advance!

1

There are 1 answers

2
Eugen Schindler On

Maybe it happens because you are running MATLAB next to MPS? The following link suggests to try launching MATLAB engine with -nojvm -nodisplay -nosplash options as well: https://nl.mathworks.com/matlabcentral/answers/348575-matlabpath-bin-glnxa64-libnativemvm-so-already-loaded-in-another-classloader