Java web项目通过JRI调用R,总是报NoClassDefFoundError: org/rosuda/JRI/RMainLoopCallbacks

豆粥 发布于 2013/08/16 11:09
阅读 1K+
收藏 0

开发环境: windows-64bit, java 32bit, MyEclipse blue (tomcat7), R3.0.1

项目中导入了JRI.jar,并将jri.dll(32bit) 放在了C:\Program Files (x86)\Java\jre7\bin;C:\tomcat\bin

XXService类中函数的部分内容
System.out.println(System.getProperty("java.library.path")); 
System.loadLibrary("jri");
TestDLL atest = new TestDLL();
......
public class TestDLL {

	public native Rengine Rengine();
	public native boolean assign();
	public native void RList();
	public native Rengine Rengine(java.lang.String[] args, boolean runMainLoop, RMainLoopCallbacks initialCallbacks);
	static{
		System.loadLibrary("jri");
	}
	
	public void getHist_sub(){
		Rengine re = new Rengine(null, false, new TextConsole());
		System.out.println("Rengine created, waiting for R");
		REXP x;
		re.eval("setwd('C:/Users/feng/Desktop/test/')");
	}
}


详细错误如下:

java.lang.NoClassDefFoundError: org/rosuda/JRI/RMainLoopCallbacks
	service.DemoService.getHist(DemoService.java:180)
	actions.DemoAction.getHist(DemoAction.java:75)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	java.lang.reflect.Method.invoke(Unknown Source)

本地执行Java调用R未出现错误。




加载中
返回顶部
顶部