java调用jri安装配置,Java R接口(JRI)安装程序

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

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:

Install rJava within the R GUI: install.packages('rJava') - installs to C:\Users\USERNAME\Documents\R\win-library\2.15\rJava\

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"

Setup example project in Eclipse, setting VM argument: -Djava.library.path="C:\Users\USERNAME\Documents\R\win-library\2.15\rJava\jri\x64"

Restart R and load rJava with command: libraries('rJava')

Run the example program, obtaining the following exception:

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.(Rengine.java:19)

at test.JRITest.main(JRITest.java:64)

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

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?

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

Thanks.

解决方案

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值