Anup Hegde
Anup Hegde

Reputation: 11

JRI program terminates java during REngine creation

I want to call an R script using Java. I am trying the JRI method to call the R script. However my JVM gets terminated when creating an Rengine.

I am running one of the examples which has been provided alongside rJava library installation in R.

Code I have tried

Version 1:

`Rengine re=new Rengine(args, true, new TextConsole2());`

Version 2:

`Rengine re=new Rengine(args, false, new TextConsole());`

Version 3:

`Rengine re = new Rengine(new String[] { "--vanilla" }, false, null);`

All three have terminated the JVM while they were getting executed.

I am using STS 3.9.1 and have exposed the below variables before running the Java program java.library.path - pointing to the r java dll's R_HOME - pointing to the R.exe PATH - reinforcing the systems path with the paths of rJava dll's and R.exe

I am using R-3.5.0, followed all steps as per Study Trails - R and Java

and Mavlarn - R and Java but still facing the same issue. What could I be doing wrong ?

Upvotes: 1

Views: 155

Answers (1)

Abdelilah El-Hadad
Abdelilah El-Hadad

Reputation: 3

Try this one:

import org.rosuda.REngine.REngine;

REngine engine = REngine.engineForClass("org.rosuda.REngine.JRI.JRIEngine", new String[] {"-no-save"}, new REngineStdOutput(),false);

Upvotes: 0

Related Questions