V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
shuangyeying
V2EX  ›  macOS

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

  •  
  •   shuangyeying · Oct 19, 2018 · 4650 views
    This topic created in 2753 days ago, the information mentioned may be changed or developed.

    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.
    

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

    Supplement 1  ·  Oct 19, 2018

    JAVA_LIBRARY_PATH 还是得换成DYLD_LIBRARY_PATH

    4 replies    2018-10-21 11:11:23 +08:00
    shuangyeying
        1
    shuangyeying  
    OP
       Oct 19, 2018
    ```
    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
        2
    shuangyeying  
    OP
       Oct 19, 2018
    自问自答
    确实好坑啊,command+R 进入恢复模式,csrutil disable 关闭 SIP 之后就可以了。
    官方文档完全没有问题。
    shuangyeying
        3
    shuangyeying  
    OP
       Oct 20, 2018
    已经搞定,有需要的 v 友可以参考我的博客。
    [macOS Mojave 上 Matlab 2018a 与 Java 的联合编程]( https://streamelody.github.io/2018/10/mojave-matlab-2018a-java/)
    zhengnanlee
        4
    zhengnanlee  
       Oct 21, 2018 via iPhone
    感谢支持我司产品
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   817 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 22:31 · PVG 06:31 · LAX 15:31 · JFK 18:31
    ♥ Do have faith in what you're doing.