I'm trying to use the Mathworks MATLAB Engine API for Java on my Macbook Pro.
By following this guide on the mathworks website I have added the /extern/engines/java/jar/engine.jar to the classpath, and I've also used a tcsh shell to add /bin/maci64 to the DYLD_LIBRARY_PATH variable.
However when I attempt to run the simple code below, I get the error message;
Exception in thread "main" java.lang.UnsatisfiedLinkError: no nativemvm in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.mathworks.mvm.MvmImpl.loadLibrary(MvmImpl.java:107)
at com.mathworks.mvm.MvmImpl.setJavaEngineMode(MvmImpl.java:202)
at com.mathworks.engine.MatlabEngine.<clinit>(MatlabEngine.java:69)
at MatlabTest.main(MatlabTest.java:7)
I have tried this in both Netbeans and Eclipse and I get the same error. This is the code I'm trying to run:
import com.mathworks.engine.*;
public class MatlabTest {
public static void main(String[] args) throws Exception {
MatlabEngine mtlb = MatlabEngine.startMatlab();
double[] vals = {2.0, 3.0, 5.0};
double[] ans = mtlb.feval("javaTest", vals);
for (double n: ans){
System.out.println(n);
}
mtlb.close();
}
}
Has anyone experience the same thing or knows what I might be doing wrong?