HowToInstallRJava
Short Installation Instructions for rJava
NOTE
rJava is a simple R-to-Java interface. It is comparable to the .C/.Call C interface. rJava provides a low-level bridge between R and Java (via JNI). It allows to create objects, call methods and access fields of Java objects from R.
First, have a look at the RForge.net homepage and the instructions provided on the homepage: http://www.rforge.net/rJava/index.html
Make sure that R was configured with Java support. If not, try to re-configure R by using R CMD javareconf (in any case it should not harm):
azteca# R CMD javareconf
Try to install rJava from within R:
> install.packages('rJava')
Only if this does not work, install rJava using the instructions provided below.
! The following information is meant for internal use at the CeBiTec. Any information in this document is provided without any warranty. !
Prerequisites
- Java >= 1.6.x
- R >= 2.11.x
R should be configured with --enable-R-shlib
switch (which is the case by default). Please make sure that compiler and linker flags are set up appropriately (see [HowToBuildR_ForSolaris] for further details).
Obtaining the Sources
Download the newest version (Attention! check compatibility with installed R version) from RForge.net: http://www.rforge.net/rJava/files/
Installation
You need to be a privileged user to install rJava in the standard location of R libraries and Perl modules. At the console, type:
azteca# R CMD INSTALL rJava_x.y-z.tar.gz
(replace x.y-z with the actual version) and
azteca# R --arch amd64 CMD INSTALL --libs-only rJava_0.8-7.tar.gz
to install the amd64 version of rJava.
Setting up the Environment
For java applications to execute R commands from within compiled java you have to set LD_LIBRARY_PATH
, and R_HOME
:
R_HOME=/vol/r-2.11/lib/R # please adjust! export R_HOME R_JAVA_LIB=$R_HOME/library/rJava/jri LD_LIBRARY_PATH=$R_HOME/lib:$R_JAVA_LIB:$LD_LIBRARY_PATH export LD_LIBRARY_PATH