Can't find dependent libraries when trying to load JRI

本小妞迷上赌 提交于 2019-12-08 21:44:33

问题


I have this simple piece of code that tries to load the JRI module.

 public static void main(String... args) {
    System.out.println(System.getProperty("java.library.path").toString());
    System.setProperty("jri.ignore.ule", "yes");
    System.loadLibrary("jri");
}

I am passing the java.library.path as VM arguments but JRI fails to load with the following error:

C:\Users\Abhishek\Documents\R\win-library\3.1\rJava\jri;C:\Users\Abhishek\Documents\R\win-library\3.1\rJava
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Abhishek\Documents\R\win-library\3.1\rJava\jri\jri.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at pack.TestJRI.main(TestJRI.java:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Thanks in advance for your help.


回答1:


I know that the post is relatively old and this might not answer the OP's question but will definitely help others who run into a similar situation as like this.

Despite the fact that you're passing the java.library.path through arguments, you should explicitly set the location of the DLL files via the PATH environment variable.

A quick reference to a similar question is provided here but not in context of R, but a different DLL altogether.

On the other hand, you could either run this command on your command prompt to check the value of your environment variable PATH...

java -XshowSettings:properties -version

Hope this helps!



来源:https://stackoverflow.com/questions/28054639/cant-find-dependent-libraries-when-trying-to-load-jri

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!