I am trying to pass a double array into R, sum its values, and return it to Java. Here is what I am trying to do in Java:
import org.rosuda.JRI.REXP;
import org.rosuda.JRI.Rengine;
// Start R session.
Rengine re = new Rengine (new String [] {"--vanilla"}, false, null);
// Check if the session is working.
if (!re.waitForR()) {
return;
}
re.assign("x", new double[] {1.5, 2.5, 3.5});
REXP result = re.eval("(sum(x))");
System.out.println(result.asDouble());
re.end();
However, I get the errors: import org.rosuda.JRI.REXP cannot be resolved import org.rosuda.JRI.Rengine cannot be resolved Rengine cannot be resolved to a type
This is the case even if for the imports I do:
import java.lang.Object.org.rosuda.JRI.REXP;
import java.lang.Object.org.rosuda.JRI.Rengine;
Any advice? Thank you!!