Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find dependent libraries when trying to load JRI

Tags:

r

jri

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.

like image 340
Abhishek Dey Das Avatar asked Jan 20 '15 20:01

Abhishek Dey Das


1 Answers

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!

like image 92
N00b Pr0grammer Avatar answered Sep 19 '22 10:09

N00b Pr0grammer