I'm new to R and was attempting to call a simple rJava test program from java. I have done the necessary path settings and when I am attempting to create a Rengine instance the code is failing. The issue seems to be with C [R.dll+0x26036]. However, I am new to this and not being able to figure out the issue. Any help will be welcome.
My code :
import org.rosuda.JRI.REXP;
import org.rosuda.JRI.Rengine;
public class First_R {
public static void main (String args []) {
System.out.println("Start");
Rengine.DEBUG = 5;
System.out.println("Starting Rengine..");
System.out.println("R_HOME =" + System.getenv("R_HOME"));
final Rengine re = new Rengine ();
// 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();
}
}
The output:
Start Starting Rengine.. R_HOME =D:\Program Files\R\R-3.2.0\bin\
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006c726036, pid=4588, tid=1872
JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build 1.8.0_45-b14) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode windows-amd64 compressed oops) Problematic frame: C [R.dll+0x26036]
Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
An error report file with more information is saved as: