I have just installed the Matlab Runtime on:
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid
You can find the Matlab runtime here in my case in installed R2015b (9.0)* (MATLAB Runtime 9.0, for R2015b, is intended to work with MATLAB 8.6, which is also R2015b).
The Matlab libraries get installed to: /usr/local/MATLAB
I am using Netbeans 8.0.2
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
The error I get off my program is as follows:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the required library libmwmclmcrrt.so.9.0 on java.library.path.
This library is typically installed along with MATLAB or the MCR. Its absence may indicate an issue with that installation or the current path configuration.
The MCR version that this component is trying to use is: 9.0.
On the install of Matlab it does say:
On the target computer, append the following to your LD_LIBRARY_PATH environment variable: /usr/local/MATLAB/MATLAB_Runtime/v90/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/sys/os/glnxa64:
I have added this line to Project > Properties > VM Options:
-Djava.library.path="/usr/local/MATLAB/MATLAB_Runtime/v90/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/sys/os/glnxa64:"
And I have added the same folders to Project > Properties > Libraries using the: Add JAR/Folder button.
I have put the following line of code into my program:
System.out.println(System.getProperty("java.library.path"));
To which I get output correctly as:
/usr/local/MATLAB/MATLAB_Runtime/v90/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/sys/os/glnxa64:
However, it continues to fail to run with the same error.
I installed IntelliJ IDEA Community edition and with no mods at all and the code just runs without any issues. I really wish to keep with Netbeans and would like to understand the issue. Any ideas?
IntelliJ has the following loaded:
/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java
-Didea.launcher.port=7532
-Didea.launcher.bin.path=/home/code/idea-IC-143.1821.5/bin
-Dfile.encoding=UTF-8
-classpath /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/cldrdata.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/dnsns.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/icedtea-sound.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/java-atk-wrapper.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/localedata.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/nashorn.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunec.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunjce_provider.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunpkcs11.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/zipfs.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/jce.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/jsse.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/management-agent.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/resources.jar
:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/rt.jar
:/home/code/NetBeansProjects/CO2model/out/production/TestModelABC
:/home/code/NetBeansProjects/CO2model/TestModelABC/dist/lib/co2model.jar
:/home/code/NetBeansProjects/CO2model/TestModelABC/dist/lib/javabuilder.jar
:/home/code/NetBeansProjects/CO2model/for_redistribution_files_only/co2model.jar
:/home/code/idea-IC-143.1821.5/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain test.Startup
.
:
:/usr/local/MATLAB/MATLAB_Runtime/v90/runtime/glnxa64
:/usr/local/MATLAB/MATLAB_Runtime/v90/bin/glnxa64
:/usr/local/MATLAB/MATLAB_Runtime/v90/sys/os/glnxa64
:
:/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni
:/lib/x86_64-linux-gnu
:/usr/lib/x86_64-linux-gnu
:/usr/lib/jni
:/lib
:/usr/lib
LD_LIBRARY_PATH
env variable? Try closing netbeans, then runexport LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Runtime/v90/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v90/sys/os/glnxa64: ; netbeans &
to restart it. – heeneneejava.library.path
is not enough, it works when loading immediate native libraries, but fails when those libraries are referencing other native libraries of their own. You should also set the OS-specific variable for finding shared libraries (PATH
on Windows,LD_LIBRARY_PATH
on Linux, andDYLD_LIBRARY_PATH
on Mac). – Amroversion -java
inside MATLAB. – Amrojava.library.path
maps to thePATH
environment variable. On Linux systems, it isLD_LIBRARY_PATH
, I guess. This path variable should contain the directoy to the runtime libraries. On Windows this is<mcr-dir>\runtime\win64
. The classpath does not need to have this directory. It only needs to have the appropriate JAR file (we use thejavabuilder.jar
). – Seelenvirtuose