I tried to execute some r code from java using Rserve:
try {
RConnection conn = new RConnection();
conn.eval("write.csv(PoS, file = 'C:/test/PoS.csv',row.names=FALSE)");
} catch (REngineException eR) {
System.err.println("Exception: "+ eR);
throw new TestException("syntax error on eval on R code");
} catch(Exception e){
e.printStackTrace();
throw new TestException("parseAndEval did not generate an exception on syntax error" );
}
I got the eval failed error. But I can successfully execute the Rcode in R:
write.csv(PoS, file = 'C:/test/PoS.csv',row.names=FALSE)
I am sure that Rserve() has been started on the R side, and other statements like
conn.eval("iris");
is possible.