I have this strange error while trying to load some R libraries (for example stats4, plyr, dplyr, sqldf) using JRI in java. Instead, with some others, like stringr or stats, everything is apparently fine.
I wrote a very easy Java program just to try JRI functionalities and it's crashing as soon as I execute the R command library(plyr).
public static void main(String[] args) {
// TODO Auto-generated method stub
//check if the R_Home variable is set up correctly
System.out.println("R_HOME =" + System.getenv("R_HOME"));
// create a script engine manager:
Rengine re = new Rengine(new String[] {"--vanilla"},false,null);
re.eval("vet<-seq(1,6)");
re.eval("media<-mean(vet)");
System.out.print(re.eval("print(media)"));
re.eval("library(plyr)");
}
The program prints out the R_HOME variable and the value 3.5 contained in the R variable media, but then crashes giving strange this error:
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x149f3806, pid=15672, tid=0x00003b8c
#
# JRE version: Java(TM) SE Runtime Environment (8.0_152-b16) (build 1.8.0_152-b16)
# Java VM: Java HotSpot(TM) Client VM (25.152-b16 mixed mode windows-x86 )
# Problematic frame:
# C [R.dll+0xc3806]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
As suggested in another answer relating to a similar problem i have tried also to replace with the following line of code the creation of a new Rengine but the library load fails again.
...
String args1[] = new String[10];
Rengine re = new Rengine(args,false,null);
...
I'm new with JRI so I don't know what else to try to have the R libraries loaded correctly. I even check the R library to check if they are installed and all of them are there. In addition to that, I've run an R script with those libraries directly in R and no errors there.
Using eclipse kepler, R version 3.4.3
Thanks for your support!
User contributions licensed under CC BY-SA 3.0