使用Eclipse运行时出现rJava错误 [英] rJava error when running with Eclipse

查看:233
本文介绍了使用Eclipse运行时出现rJava错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了R 3.0.1和Eclipse Kepler。 (我已经安装了StatE来运行R脚本和Eclipse R-console,没有任何问题)但是,我似乎无法得到一个java程序来运行。我发布我的问题,看看有没有人遇到过他们,或者可以帮助我了解我做错了什么。在安装R,rJava(通过R)和eclipse之后,我从studytrials.com运行了RJavaEclipse插件。然后我配置了路径到相应的库或.dll。





当我尝试运行rJava JRI附带的rtest.java文件时,我收到以下错误:



找不到JRI本地库!
请确保JRI本机库位于java.library.path中列出的目录中。

  java。 lang.UnsatisfiedLinkError:java.library.path中没有jri 
在java.lang.ClassLoader.loadLibrary(未知来源)
在java.lang.Runtime.loadLibrary0(未知源)
在java .lang.System.loadLibrary(Unknown Source)
在org.rosuda.JRI.Rengine。< clinit>(Rengine.java:19)
在rtest.main(rtest.java:61)

当我尝试通过eclipse - >运行配置 - > R - > rtest中的运行选项卡运行时,我得到一个弹出警告,说:

  R_HOME必须设置或R正确安装(\Software\R- core\InstallPath注册表项必须存在)。 

所以,按照SO这么多的建议,我试图在警告中找到答案消息。



我发现Eclipse(和Windows)中的路径信息指向库和R运行配置中的正确位置:

(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)



这些路径也符合Windows环境路径。





所以,我很失落。如果有人对我的问题有任何建议,我将非常感谢。请注意,如果您需要任何其他信息。

解决方案

我在Linux上有完全相同的问题。实质上,这个设置不正确地更新 java.library.path ,并且与JRI jar的链接失败。我开始通过打印到控制台的路径:



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



并得到这个:



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



为了确保Eclipse在运行时正确更新 java.library.path ,必须将本地库位置项目设置为包含JRI jar的文件夹( / usr / local / lib / R / site-library / rJava / jri 在我的情况下):





只需选择该项目,然后单击编辑... 即可更改其值。 / p>

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.

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: (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.

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.

解决方案

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):

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

这篇关于使用Eclipse运行时出现rJava错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆