我尝试过这个方法,就像在这个网站中一样:"http://codophile.com/2015/04/15/how-to-integrate-r-with-java-using-rjava/“遵循指示,在eclipse中运行,但是得到了错误:
“无法找到JRI本机库!请确保JRI本机库位于java.library.path中列出的目录中。”
稍后将jri.dll从rjava库位置复制到本机jdk文件夹中,并再次重新运行,得到了输出!
也尝试过这种方法:
-Djava.library.path="C:\Users\[USER_NAME]\Documents\R\win-library\3.5\rJava\jri\x64;C:\Program Files\R\R-3.5.0\bin\x64";"C:\Program Files\Java\jdk1.8.0_172\jre\bin";"C:\Program Files\Java\jdk1.8.0_172\bin"
在eclipse参数中。除非将jri复制到本机java libary,否则无法获得输出。
但是,我需要一些其他方法,比如将.dll文件复制到jdk文件夹并不是很正确的方法。如果有其他好的方法来获得输出,请回复。
发布于 2018-06-01 09:47:45
试试这个简单的检查,如果目录名中没有错误的地方。
Jri.java
import java.io.File;
public class Jri {
public static void main(String[] args) {
String[] paths = System.getProperty("java.library.path").split(";");
for (String path : paths) {
File file = new File(path + "/jri.dll");
System.out.printf("file: %s exists: %s%n", file, file.exists());
}
// when the library was found in one of the locations
// this call should not throw an exception
System.loadLibrary("jri.dll");
}
}编译源代码
java Jri.java使用JVM属性运行它。
java -Djava.library.path=[put here the directories] Jri如果没有在任何位置找到该文件,请检查是否输入。
发布于 2018-06-01 10:12:00
我想你可以试试这个。重新配置路径,增加
%R_HOME%\library\rJava\jri\i386;
%R_HOME%\bin\i386 these two paths.在使用java代理R之前,尝试使版本统一
https://stackoverflow.com/questions/50637977
复制相似问题