1

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)
vicangel
  • 162
  • 2
  • 18

1 Answers1

0

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.

Daniel Junglas
  • 5,830
  • 1
  • 5
  • 22
  • This answer is not far from the truth that I should add the mkl_rt.dll to the java library path but when I do this my application does not take into consideration the project dependencies so I try to find the best way to integrate with dll and jar libraries – vicangel Mar 18 '20 at 12:29
  • My real problem is that when i add programmaticaly or via eclipse the path of the dll. My application does not seem to "see" my dependencies – vicangel Mar 18 '20 at 13:00
  • I am not sure what the remaining issue is. I don't see how adding `-Djava.library.path` to the eclipse configuration would hurt dependencies or JARs. Maybe you can show exactly what you are doing? Or the command line that eclipse uses to start your JVM? In eclipse, if you go to the run configuration for your project and on the "Arguments" tab add `-Djava.library.path=...` to the "VM arguments" box, isn't that enough to get things going? – Daniel Junglas Mar 18 '20 at 13:24
  • The error you posted seems unrelated to the code you quoted. There is no NLMatrix class in the backtrace. In any case, this seems to be a *different* error. Maybe fixing the issue with the DLL got you one step further and now you are facing a new and different error? – Daniel Junglas Mar 18 '20 at 14:08
  • Yes you are right, the code that i pasted is the initial error, I didnt advocated well. But what i try to say is that ok I added the dll why does not see method that i have in my dependencies. – vicangel Mar 18 '20 at 14:17