java.library.path, classpath Netbeans 8.0.2
我刚刚在以下位置安装了 Matlab 运行时:
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid
在我的情况下,您可以在已安装的 R2015b (9.0)* 中找到 Matlab 运行时(对于 R2015b,MATLAB 运行时 9.0,旨在与 MATLAB 8.6 一起使用,也称为 R2015b)。
Matlab 库安装到:/usr/local/MATLAB
我使用的是 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)
我从程序中得到的错误如下:
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.
在Matlab的安装上,它确实说:
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:
我已将以下行添加到项目>属性> VM 选项:
-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:"
我已使用“添加 JAR/文件夹”按钮将相同的文件夹添加到项目>属性>库中。
我已经将以下代码行放入我的程序中:
System.out.println(System.getProperty("java.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:
但是,它仍然无法运行,并出现相同的错误。
我安装了IntelliJ IDEA社区版,根本没有mod,代码只是运行没有任何问题。我真的希望继续使用 Netbeans,并希望了解这个问题。有什么想法吗?
IntelliJ 加载了以下内容:
/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