I am trying to setup a Java project on a Windows computer that invokes R code using rJava/JRI. I have installed JDK 1.8
, R 3.5.3
and rJava
library in R on my computer. I have added the following to my Path
variable: D:\Program Files\R\R-3.5.3\bin\x64; D:\Program Files\R\R-3.5.3\library\rJava\jri\x64
. I have also configured the Build Path in Eclipse by adding the three JAR files from the jri folder as external JARs and by changing the native library to D:/Program Files/R/R-3.5.3/library/rJava/jri/x64
. These are the same steps that I've recently done on another Windows computer and afterwards the R test script worked perfectly. However, on my current computer I keep getting the following message:
Please make sure that the JRI native library is in a directory listed in java.library.path.
java.lang.UnsatisfiedLinkError: D:\Program Files\R\R-3.5.3\library\rJava\jri\x64\jri.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
at rtest.main(rtest.java:61)
Any idea what's going wrong? I would be really greatful for any help.
EDIT: Here is what my Build Path looks like:
EDIT2: Additionally, I have now copied all .DLL
files from D:\Program Files\R\R-3.5.3\bin\x64
together with jri.dll
to D:\Program Files\Java\jdk1.8.0_201\bin
as recommended here. Still no luck.
Ok, I got it. After having done everything that is listed in the first post, I also copied all .DLL
files from D:\Program Files\R\R-3.5.3\bin\x64
together with jri.dll
from D:\Program Files\R\R-3.5.3\library\rJava\jri\x64
to D:\Program Files\Java\jre1.8.0_201\bin
(in addition to the JDK
folder). Now the test script works. Thanks to everyone who tried to help!