I have followed guides on the web and looked at questions on stackoverflow but I am still not able to set up JRI on Windows.
Here are the steps I have taken:
Latest (2018) for me was to do this :-
export R_HOME=$(R RHOME)
Then compile this:-
String[] enginargs = {"--no-save"};
REngine engine = org.rosuda.REngine.JRI.JRIEngine.createEngine(enginargs, null, false);
try {
engine.parseAndEval("print(\"Hello from R\");");
}
catch(Exception e ) {
System.err.println("OOps:-" + e.getMessage());
}
finally {
engine.close();
}
Then when running the java either set the LD_LIBRARY_PATH to enclude JRI or set the -Djava.library.path eg
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/R/site-library/rJava/jri/
or
java -Djava.library.path=/usr/local/lib/R/site-library/rJava/jri/ MyMainClass
How you instantiating Rengine?
It should be something like this:
Rengine rengine = new Rengine(args, false, null);
where, the args could be from your main method.
Let me know if this works!