Append library path to "DYLD_LIBRARY_PATH" in MAC

58 views (last 30 days)
I am trying to use the Java engine in version 2017b of Matlab. I am trying to run the examples found in extern/examples/engines/java - "EngineConsoleDemo" and EngineGUIDemo". and have followed the directions in the ReadMe for Mac, adding the /bin/maci64 to the DYLD_LIBRARY_PATH. I get the error "no nativemvm found in java.library.path".

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 May 2021
Edited: MathWorks Support Team on 19 May 2021
In order to execute a Java engine program, it depends on this "nativemvm" library. Thus, we have to tell JAVA where to find this library.
There are two approaches to do that:
1. We could directly tell JAVA the location of that library, by specifying Java Library Path and Run Program
java -Djava.library.path=matlabroot/bin/maci64 -classpath .:matlabroot/extern/engines/java/jar/engine.jar MyJavaCode
2. We could also set the environment variable, then JAVA will search all the path in the variable, until finding this library.
However, OS X EI Capitan and later includes security technology, which no longer supports the environment variable "DYLD_LIBRARY_PATH". If we print all the environment variable, "DYLD_LIBRARY_PATH" is not on the list. So if we add the path into "DYLD_LIBRARY_PATH", actually it means we just create a variable named "DYLD_LIBRARY_PATH" in current terminal, but "DYLD_LIBRARY_PATH" is not a system environment variable. So if we launch MATLAB outside this shell, for example, but clicking the icon on the desktop, or launching it in a new terminal, MATLAB will not find the environment variable "DYLD_LIBRARY_PATH" we have created in another terminal.
If you want to work by adding variable "DYLD_LIBRARY_PATH", please launch MATLAB by command line in the terminal added variable "DYLD_LIBRARY_PATH".
For more information about MAC SIP please refer to the following links:

More Answers (0)


No tags entered yet.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!