简体   繁体   中英

MatlabControl.java throws exceptions

I'm trying to use the MatlabControl.java with the following code:

public static void main(String[] args) {
    MatlabControl mc = new MatlabControl();
    mc.eval(new String("x=5")); 
}

but it throws the following exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.mathworks.jmi.NativeMatlab.PostMatlabRunnable(JZ)V
at com.mathworks.jmi.NativeMatlab.PostMatlabRunnable(Native Method)
at com.mathworks.jmi.NativeMatlab.postMatlabRunnable(NativeMatlab.java:521)
at com.mathworks.jmi.MatlabLooper.postMatlabRunnable(MatlabLooper.java:177)
at com.mathworks.jmi.Matlab.whenMatlabReady(Matlab.java:1609)
at matlabCon.MatlabControl.eval(MatlabControl.java:85)
at matlabCon.MatlabCon.main(MatlabCon.java:8)

I've saw this problem here too: call MATLAB in Java via MatlabControl.java

and followed the instructions - with no success. I've added all of the Jars I need.

can anyone help me?

thanks.

The error means that it's unable to load the corresponding Matlab native libraries. This can be caused by having a 32-bit Matlab and a 64-bit JVM (for example), or it could be that your JVM doesn't have the path/library set up to point to your Matlab installation (where it's loading the native library from). Check the instructions for how to install and configure Matlab accordingly, and verify that you're using a 32-bit JVM for 32-bit Matlab, or a 64-bit JVM for a 64-bit Matlab.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM