Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.library.path, classpath Netbeans 8.0.2

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
like image 663
DevilCode Avatar asked Feb 12 '16 00:02

DevilCode


1 Answers

java.library.path is the path that java uses to find native libraries.. An error would be caused if

  • There is no file called libmwmclmcrrt.so in the path
  • The permissions of the file libmwmclmcrrt.so is not correct

So my advice would be to run a search with name libmwmclmcrrt.so to know whether the file is in the system or not.. If found you could manually copy-paste it to this 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

If already present in that path maybe you could check the file permissions..

In most of the cases the error is caused because the library isn't found..

like image 144
Vaibhav G Avatar answered Sep 20 '22 13:09

Vaibhav G