[R] Use R in Java

Rajarshi Guha rguha at indiana.edu
Tue Aug 1 22:00:01 CEST 2006


On Wed, 2006-08-02 at 03:44 +0800, TAN Chong Hui wrote:
> Hi
> 
> I'm trying to use R from Java.
> There doesn't seem to be much documentation on this. 
> I installed JGR that has JRI and Rjava coming with it.
> 
> According to the short description at www.rosuda.org/JRI/,
> there's supposed to be an "examples" directory in JRI.
> I don't seem to be able to find that.
> 
> I tried to install JRI on its own (not with JGR) from rosuda.
> But there seems to be some error with the zip-file.
> 
> Help, anybody?

I don't know how it'd work on Windows (though I suppose it should be
similar) but on Linux, you basically need to 

* Put JRI.jar in your CLASSPATH
* Put libjrio.so in your LD_LIBRARY_PATH (libR.so should also be in this
PATH)
* Set R_HOME to point to wherever you installed R

Also if you only want to use R from Java (and don't need Java from R)
then you should not need Rjava at all. The JRI source's should be
sufficient.

The CDK uses JRI to use R as a backend and you can take a look at the
code that we use to interact with R. On example can be seen at 

http://svn.sourceforge.net/viewvc/cdk/trunk/cdk/src/org/openscience/cdk/qsar/model/R2/RModel.java?view=markup

-------------------------------------------------------------------
Rajarshi Guha <rguha at indiana.edu>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Q: What's purple and commutes?
A: An abelian grape.



More information about the R-help mailing list