Java调用R环境配置问题:Cannot find JRI native library!

本文详细介绍了当遇到Java程序无法找到JRI native library错误时的解决方案,包括正确设置环境变量R_HOME,确保R.dll路径在系统PATH中,以及在工程中配置java.library.path指向jri.dll所在路径的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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\----\R\win-library\3.5\rJava\jri\x64\jri.dll: Can't find dependent libraries

 

依照官网解释

 

Q: I get the following error, what's wrong?
java.lang.UnsatisfiedLinkError: no jri in java.library.path
A: Usually it means that you didn't setup the necessary environment variables properly or the JRI library is not where it is expected to be. The recommended way to start JRI programs is to use the run script which is generated along with the library. It sets everything up and is tested to work. If you want to write your own script or launcher, you must observe at least the following points:
  • R_HOME must be set correctly
  • (Windows): The directory containing R.dll must be in your PATH
  • (Mac): Well, it's a Mac, so it just works ;).
  • (unix): R must be compiled using --enable-R-shlib and the directory containing libR.so must be in LD_LIBRARY_PATH. Also libjvm.so and other dependent Java libraries must be on LD_LIBRARY_PATH.
  • JRI library must be in the current directory or any directory listed in java.library.path. Alternatively you can specify its path with
    -Djava.library.path= when starting the JVM. When you use the latter, make sure you check java.library.path property first such that you won't break your Java.
  • Depending on your system, the R verison and other features you want to use, you may have to set additional settings such as R_SHARE_DIR, R_INCLUDE_DIR and R_DOC_DIR.

1、在环境变量中设置R_HOME;

2、在系统path中加入路径,指向包含R.dll的目录,如果你的系统为64位系统,可能是在x64目录中
3、工程中配置java.library.path为jri.dll所在的路径

设置完成以后记得重新启动eclipse

 

转载于:https://www.cnblogs.com/qianheng/p/9901115.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值