Search code examples
rjavajri

JRI: how to get the console output in a Java String


I declare the JRI engine as follows in my Java program:

REngine eng = REngine.engineForClass("org.rosuda.REngine.JRI.JRIEngine", 
    args, new REngineStdOutput(), false);

This works fine however I would like to get the console output in a Java String instead of the Java console.

I researched REngineStdOutput but couldn't find much. Any ideas?


Solution

  • You have to implement org.rosuda.JRI.RMainLoopCallbacks interface - in particular rWriteConsole() will be called with each output string.