Question

I have installed R 3.0.1 and Eclipse Kepler. (I have installed StatE to run R-script through and Eclipse R-console with no problem.) However, I cannot seem to get a java program to run. I'm posting my issues to see if anyone else has encountered them or can help me understand what I'm doing wrong. After installing R, rJava (through R), and eclipse, I ran the RJavaEclipse Plugin from studytrials.com. Then I configured the paths to the appropriate libraries or .dll.

enter image description here

When I try to run the rtest.java file that comes with the rJava JRI, I get the following error:

Cannot find JRI native library! Please make sure that the JRI native library is in a directory listed in java.library.path.

java.lang.UnsatisfiedLinkError: no jri 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 org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
    at rtest.main(rtest.java:61)

When I try to run via the run tab in eclipse -> run configurations -> R -> rtest, I get a pop-up warning that says:

R_HOME must be set or R properly installed (\Software\R-core\InstallPath registry entry     must exist).

So, following the advice that so many on SO give, I tried to find the answer in the warning message.

I found the path information in Eclipse (and Windows) was pointing to the correct locations both in the library and in the R run configuration:enter image description here enter image description here (C:\Users\csnyder\Documents\R\win-library\3.0\rJava\jri\x64;C:\Program Files\Java\jre7\bin\server;C:\Program Files\R\R-3.0.1\bin\x64)

These paths also match the windows environmental paths.

enter image description here

So, I'm at a loss. If anyone has any suggestions on what my issue might be, I would greatly appreciate it. Please comment if you require any additional information.

Was it helpful?

Solution

I had the exact same problem on Linux. In essence, this set up is not updating java.library.path properly and the linkage to the JRI jars fails. I started by printing the path to the console with:

System.out.println(System.getProperty("java.library.path"));

And got this:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

To guarantee that Eclipse updates java.library.path correctly at run time, the Native library location item must be set to the folder containing the JRI jars (/usr/local/lib/R/site-library/rJava/jri in my case):

enter image description here

Just select the item and click Edit... to change its value.

OTHER TIPS

you can try to add the jri.dll(in your rJava/jri/x64 package) on the System environment variable path,like this:(sorry I cann't put the picture on it ) in that way ,then restart your IDE and just run your test.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top