1

I'm working on a Windows 7 machine with R 3.1.0. I downloaded rcaller 2.2 and the latest 2.3 and followed the example of Sequential Commands in the tutorial. However, the program does not stop in Eclipse after the last line of code is executed.

The R.exe and Rterm.exe are still in the task manager. And every time I re-run the program, another R.exe and Rterm.exe are added in the task manager...

The following is the Java code:

import rcaller.RCaller;
import rcaller.RCode;

public class RCallerOnlineTest {
    public static void main(String[] args) {
        RCaller caller = new RCaller();
        // change to your path please
        caller.setRExecutable("C:/R/R-3.1.0/bin/x64/R.exe"); 
        RCode code = new RCode();
        caller.setRCode(code);
        code.addDoubleArray("x", new double[]{1.0, 2.0, 3.0, 4.0, 50.0});
        code.addRCode("result <- mean(x)");
        caller.runAndReturnResultOnline("result");
        double mean = caller.getParser().getAsDoubleArray("result")[0];
        System.out.println("mean: " + mean);

        boolean status = caller.stopStreamConsumers();
        System.out.println(status);
   }

}

The output is the following:

mean: 12.0
true

So the last print out true. I assume that it indicates rcaller is stopped, but it's not. Am I missing something here? I couldn't find a method called stop in the library...

  • I can't get past a NullPointerException on the `caller = new RCaller()` line. – Spacedman Jun 11 '14 at 16:47
  • hi @Spacedman, could you give me more details? I can't replicate your exception in my Eclipse... –  Jun 11 '14 at 17:14
  • Just saying that I can't get as far as your example working. In fact with a different RCaller version my CPU just span like mad, with another I get this NullPointerException, and at that point I gave up. Seems well flaky... I'm sticking to RPy. – Spacedman Jun 11 '14 at 17:19
  • 1
    OK thanks for the help anyway. My company's using Java so I have to stay with it... –  Jun 11 '14 at 17:24
  • Where did you get 2.2 and 2.3 from? Source and then build? – Spacedman Jun 11 '14 at 17:27
  • from here http://stdioe.blogspot.com.tr/2014/05/new-release-rcaller-230_15.html and there's a link to Google drive. You can download both complied jar files. –  Jun 11 '14 at 17:33
  • mvn test runs okay now but the example I tried (SimplePlot) hangs at end the same as your code does for me. Hmmm. – Spacedman Jun 11 '14 at 18:06
  • I had a note on this issue and I will try to fix it as soon as possible in the next release of 2.4 – jbytecode Jun 11 '14 at 18:22

1 Answers1

0

Thank you for your post. The revision 59bfd7335cb8 fixes this problem, at least I hope. The method StopRCallerOnline() in class RCaller now stops the R instance in the memory which is created in runAndReturnResultOnline(). All test files passed and there are no R processes still stay in the task manager.

After more comprehensive tests, I plan to compile and publish the version 2.4 in 15th June. But you are still able to download the source tree and compile yourself using maven

Hope works for you.

jbytecode
  • 681
  • 12
  • 29
  • Well that's great! Thank you for fixing it so quickly! –  Jun 11 '14 at 19:27
  • please try it out and give me a response – jbytecode Jun 11 '14 at 19:29
  • eh I'm not familiar with maven. Can I just compile it in Eclipse as Jar file or directly use the Java class? –  Jun 11 '14 at 19:52
  • please get my e-mail address which is written in the source code, write me a short e-mail and let me send the compiled jar file. – jbytecode Jun 11 '14 at 19:54
  • 1
    version 2.4 is publicly available and the details are in page http://stdioe.blogspot.com.tr/2014/06/rcaller-24-has-just-been-released.html rcaller.StopRCallerOnline(); method should be invoked after sequential R commands are run via runAndReturnResultOnline(); – jbytecode Jun 16 '14 at 19:37