macOS Mojave
Matlab 2018a
java version "1.8.0_144"
按照官方文档配置了 Java 环境
https://www.mathworks.com/help/compiler_sdk/java/configure-your-java-environment.html
以下是我环境变量的配置
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
export JAVA_LIBRARY_PATH=/Applications/MATLAB/MATLAB_Runtime/v94/runtime/maci64:/Applications/MATLAB/MATLAB_Runtime/v94/sys/os/maci64:/Applications/MATLAB/MATLAB_Runtime/v94/bin/maci64:/Applications/MATLAB/MATLAB_Runtime/v94/extern/bin/maci64
export CLASSPATH=.:/Applications/MATLAB_R2018a.app/toolbox/javabuilder/jar/javabuilder.jar
在 IDEA 中执行还是出错了
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the required library libmwmclmcrrt.9.4.dylib on java.library.path.
This library is typically installed along with MATLAB or the MATLAB Runtime. Its absence may indicate an issue with that installation or
the current path configuration, or a mismatch with the architecture of the Java interpreter on the path.
MATLAB Runtime version this component is attempting to use: 9.4.
Java interpreter architecture: maci64.
大家有什么思路没有呀?谢谢!
JAVA_LIBRARY_PATH 还是得换成DYLD_LIBRARY_PATH
1
shuangyeying OP ```
New versions of OS X enable system integrity protection per default. Meaning that setting the DYLD_LIBRARY_PATH and LD_LIBRARY_PATH will have no effects. I had this issue before in another context, but it looks like it's a common issue on other Node modules as well: oracle/node-oracledb#231 ``` 不知道和 SIP 有关系么? |
2
shuangyeying OP 自问自答
确实好坑啊,command+R 进入恢复模式,csrutil disable 关闭 SIP 之后就可以了。 官方文档完全没有问题。 |
3
shuangyeying OP 已经搞定,有需要的 v 友可以参考我的博客。
[macOS Mojave 上 Matlab 2018a 与 Java 的联合编程]( https://streamelody.github.io/2018/10/mojave-matlab-2018a-java/) |
4
zhengnanlee 2018-10-21 11:11:23 +08:00 via iPhone
感谢支持我司产品
|