1

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 Answers1

0

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

Eugen Schindler
  • 351
  • 1
  • 6
  • I checked that solution, but it does not work. In my case, the problem occurs only if I build once, run and then build again. – Salman Rahman Sep 07 '17 at 11:21
  • Actually finally I solved it by myself, I was having a cyclic dependency in the dependency list and that is why I was having the problem, I cleared the cyclic dependency and everything worked really well. – Salman Rahman Nov 08 '17 at 11:09