请教一个 Matlab 和 Java 联合编程的问题?

2018-10-19 11:34:23 +08:00
 shuangyeying

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.

大家有什么思路没有呀?谢谢!

3943 次点击
所在节点    macOS
4 条回复
shuangyeying
2018-10-19 12:40:32 +08:00
```
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 有关系么?
shuangyeying
2018-10-19 16:47:37 +08:00
自问自答
确实好坑啊,command+R 进入恢复模式,csrutil disable 关闭 SIP 之后就可以了。
官方文档完全没有问题。
shuangyeying
2018-10-20 13:09:31 +08:00
已经搞定,有需要的 v 友可以参考我的博客。
[macOS Mojave 上 Matlab 2018a 与 Java 的联合编程]( https://streamelody.github.io/2018/10/mojave-matlab-2018a-java/)
zhengnanlee
2018-10-21 11:11:23 +08:00
感谢支持我司产品

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/499059

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX