rcaller
rcaller copied to clipboard
Problems with detection of R and with StopRCallerOnline()
Hi,
my problem seems to be that my R installation, which is not located in C:\Program Files, is not recognized properly. I found a way to make RCaller work, defining the location of R via RCallerOptions, but now i can't terminate my R process anymore, as StopRCallerOnline() throws an exception.
So here are the details:
When I try to recreate an example the line
RCaller caller = RCaller.create();
throws the following exception:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.github.rcaller.rstuff.RCallerOptions.create(RCallerOptions.java:32)
at com.github.rcaller.rstuff.RCaller.create(RCaller.java:83)
at OnlineTest.main(OnlineTest.java:24)
Caused by: java.lang.NullPointerException
at java.base/java.util.Arrays.sort(Arrays.java:1249)
at com.github.rcaller.util.Globals.<clinit>(Globals.java:65)
... 3 more
When I used RCaller like 2 years ago, the function
Globals.setRPaths(String,String)
helped, but this seems to exist no more.
So I found the following solution that works
String pathToRScript = "E:\\R\\R-3.5.1\\bin\\Rscript.exe";
String pathToR = "E:\\R\\R-3.5.1\\bin\\R.exe";
RCallerOptions options = RCallerOptions.create(pathToRScript, pathToR, FailurePolicy.RETRY_1, 3000l, 100l, RProcessStartUpOptions.create());
RCaller caller = RCaller.create(options);
This makes the examples work, but when I use runAndReturnResultOnline(), I can't terminate the R process, as StopRCallerOnline() throws the following similar exception:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.github.rcaller.rstuff.RCaller.StopRCallerOnline(RCaller.java:324)
at OnlineTest.main(OnlineTest.java:42)
Caused by: java.lang.NullPointerException
at java.base/java.util.Arrays.sort(Arrays.java:1249)
at com.github.rcaller.util.Globals.<clinit>(Globals.java:65)
... 2 more
Also everything I try to do with Globals produces a similar ExceptionInInitializerError, caused by an NullPointerException at the same location:
Globals.detect_current_rscript();
System.out.println("R_current:" + Globals.R_current);
System.out.println("R_Win:" + Globals.R_Windows);
System.out.println("RScript_Win:" + Globals.RScript_Windows);
Globals.R_current = "E:\\R\\R-3.5.1\\bin\\R.exe";
Globals.Rscript_current= "E:\\R\\R-3.5.1\\bin\\Rscript.exe";
Any help is appreciated.
@tomgrille is this issue resolved or are there any code improvements for this?