I have installed JRI to run with NetBeans 7.4 using 32-bit R 3.0.2 and Java jdk1.7.0_45, on Windows 7.
I am using the following Java function.
import org.rosuda.JRI.Rengine;
import org.rosuda.JRI.REXP;
import org.rosuda.JRI.RList;
void testJRI(){
// Start JRI engine.
String[] Rargs = {"--vanilla"};
Rengine re = new Rengine(Rargs, false, null);
if (!re.waitForR()) {
System.out.println("Cannot load R");
return null;
}
REXP load=re.eval("source('C:\\\\searchPath\\\\nonparametricAnova.r')");
re.end();
return;
}
The first time the function is called, everything works fine. But the second time, the variable, load, is null - indicating failure.
I replaced the nonparametricAnova.r R function with the following simple script
simple<-function(){
a=1
a
}
which I named simple.r and called with
REXP load=re.eval("source('C:\\\\searchPath\\\\simple.r')");
Now, the second time through, it hangs on
Rengine re = new Rengine(Rargs, false, null);
I have noticed that
load=re.eval("refClusterMeasurements<-read.csv(\"C:/SearchPath/fileName.csv\", header=TRUE)");
also fails the second time through, even if "name.csv" is a minimally sized file.