[R] how can i call R program from one java program?

Romain Francois romain.francois at dbmail.com
Wed Oct 28 12:59:01 CET 2009

On 10/28/2009 12:47 PM, wesley mathew wrote:
> Dear All
> I want to call the R program from one Java program because In my project R
> program parameters are set by one web page developed by java.
> Is this possible to call R program from java?
> many thanks in advance


This has many different answers. You can :
- use ProcessBuilder to build an R process child from the java process 
(or System.exec)

- use jri to embed R within the same java process. For this you need to 
install rJava and follow the examples in the jri directory. See 
http://www.rforge.net/JRI/ http://www.rforge.net/rJava/

- run RServe and connect to it via the java client : 

rJava and Rserve share the same mailing list : 
where I would suggest you to repost (after you have browsed these options)


Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
|- http://tr.im/BcPw : celebrating R commit #50000
|- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
`- http://tr.im/yw8E : New R package : sos

More information about the R-help mailing list