java.lang.UnsatisfiedLinkError: no mkl_rt in java.library.path

1.7k Views Asked by At

I have a java8 application in windows10 that uses smile library. When i run the LLE algorithm for example i was getting this warning:

smile-netlib module is not available in the classpath. Pure Java matrix library will be employed. So I decided to add, as smile suggests in github, the smile-ntelib via maven. But after running again i get this stack trace:

java.lang.UnsatisfiedLinkError: no mkl_rt in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at smile.netlib.NLMatrix.<clinit>(NLMatrix.java:41)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at smile.math.matrix.Factory.<clinit>(Factory.java:39)
    at smile.math.matrix.Matrix.zeros(Matrix.java:98)
    at smile.manifold.LLE.<init>(LLE.java:155)
    at TestLLE.TestLLETetCase(TestLLE.java:44)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)

1) what mkl_rt is and how can i insert it in java? It means Math kernel library? 2) Also smile suggests "make their machine-optimized libblas3 (CBLAS) and liblapack3 (Fortran) available as shared libraries at runtime." How can i do this?

Edit:

I found and downloaded mkl_rt.dll and place it in a folder called dlls. My current problem is that by setting in java.library.path the folder with mkl_rt it finds the dll but it does not find functions from other dependencies. I found this code in the smile-netlib that the issue starts.

enter image description here

JMatrix (in blue) is a class from smile-math jar in the smile.math.matrix package, so when i add in path via vm arguments, programmatically or via eclipse in native location the dlls smile-netlib NLMatrix class does not find the JMatrix class which is smile-netlib and i get the following error.

java.lang.NoSuchMethodError: smile.math.matrix.Matrix.of([D)Lsmile/math/matrix/DenseMatrix;
at smile.netlib.LU.solve(LU.java:99)
at smile.manifold.LLE.<init>(LLE.java:180)
at TestLLE.TestLLETetCase(TestLLE.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
1

There are 1 best solutions below

5
On

You have to find the folder that contains mkl_rt.dll and then add that folder to the system property java.library.path. This is usually done by passing option -Djava.library.path=/path/to/folder to the JVM on startup.

mkl_rt.dll contains the efficient implementation of algorithms in native (not Java) code.