Java R接口(JRI)安装程序 [英] Java R Interface (JRI) Setup

查看:441
本文介绍了Java R接口(JRI)安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置Java / R接口(捆绑在RrJava包中),但我遇到了一些麻烦(尽管在这里和其他论坛上尝试了很多建议)。

I am trying to setup the Java/R interface (bundled in the R "rJava" package), but I am having some trouble (despite trying many suggestions here and on other forums).

我正在运行Windows 7,jdk1.7.0_05,Eclipse,R 2.15.2。这些都是64位安装。

I am running Windows 7, jdk1.7.0_05, Eclipse, R 2.15.2. These are all 64 bit installations.

我试图让示例运行的步骤如下:

The steps I have followed to attempt to get the example running are as follows:


  1. 在R GUI中安装rJava:install.packages('rJava') - 安装到C:\ Users \USERNAME \Documents\R\win-library \2.15 \ rJava \

  2. 设置环境变量:R_HOME =C:\Program Files \R\ R-2.15.2,添加到PATH =C:\ Program Files\Java\jdk1.7.0_05\bin;C:\Program Files\Java\jdk1.7.0_05\jre\bin\server;C:\Program Files \R\R-2.15.2\bin\x64 ; C:\Users\USERNAME\Documents\R\win-library\2.15\rJava\jri\x64

  3. 在Eclipse中设置示例项目,设置VM参数:-Djava.library.path =C:\ Users \USERNAME \Documents\R\win-library \\ \ n2.15 \ rJava \ jri \ x64

  4. 重新启动R并加载rJava w ith命令:libraries('rJava')

  5. 运行示例程序,获得以下异常:

  1. Install rJava within the R GUI: install.packages('rJava') - installs to C:\Users\USERNAME\Documents\R\win-library\2.15\rJava\
  2. Setup environment variables: R_HOME = "C:\Program Files\R\R-2.15.2", additions to PATH = "C:\Program Files\Java\jdk1.7.0_05\bin";"C:\Program Files\Java\jdk1.7.0_05\jre\bin\server";"C:\Program Files\R\R-2.15.2\bin\x64";"C:\Users\USERNAME\Documents\R\win-library\2.15\rJava\jri\x64"
  3. Setup example project in Eclipse, setting VM argument: -Djava.library.path="C:\Users\USERNAME\Documents\R\win-library\2.15\rJava\jri\x64"
  4. Restart R and load rJava with command: libraries('rJava')
  5. Run the example program, obtaining the following exception:

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

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: C:\Users\USERNAME\Documents\R\win-library\2.15\rJava\jri\x64\jri.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    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 test.JRITest.main(JRITest.java:64)

我已经验证java.library.path是按预期设置的,因为:System.out.println(JLP =+ System.getProperty(java.library) 。路径));输出正确的路径。

I have verified "java.library.path" is set as expected since: System.out.println("JLP = " + System.getProperty("java.library.path")); outputs the correct path.

我认为rJava可能没有完全安装(尝试重新安装),但我不知道如何检查。 ... \rJava \ jri或其任何子目录中唯一的JAR是JRI.jar,示例目录似乎不完整。

I think rJava may not have installed fully (have tried reinstalling), but I'm not sure how to check this. The only JAR in "...\rJava\jri" or any of its subdirectories is "JRI.jar" and the examples directory seems incomplete.

有没有人对这里可能出现的问题有什么建议吗?

Does anyone have suggestions on what may be going wrong here?

似乎是JRI网站( http://www.rforge.net/JRI/index.html 今天已经关闭,不确定是否有人知道下载的其他来源(除了直接来自CRAN) 。

It seems the JRI website (http://www.rforge.net/JRI/index.html) has been down today, not sure if anyone knows another source to download from (other than direct from CRAN).

谢谢。

推荐答案

尝试复制所有dll文件( * .dll)在R目录中到JAVA_PATH / bin。之后加载jri native lib,如:

Try to copy all dll files(*.dll) which in R directory to JAVA_PATH/bin. After that load the the jri native lib like:

//Right under your R class
   static {
    System.loadLibrary("jri");      
   }

我遇到了同样的问题并通过这种方法解决了这个问题。

I had the same problem and solved it by this method.

Thx

这篇关于Java R接口(JRI)安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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