Installing the rJava package

The rJava package gives access to low-level R functions to the Java interface, but it is not provided with TERR. These instructions help you prepare your computer to use rJava.

Prerequisites

The rJava package requires the following.
  • A bit-matching 32-bit or 64-bit version of the Java Runtime Environment (JRE), version 6 or later is installed.
  • The system variable JAVA_HOME is set. Follow the instructions for Setting JAVA_HOME if you are unsure.
Attention: These instructions are for installing the rJava package for use with TERR 4.2 or later. If you are using an earlier version, and you cannot update your version of TERR, see the release notes for more information for the verison of TERR you are running.
  • For TERR version 3.1 and earlier, the rJava package does not work. To use rJava, update your version of TERR.
  • For TERR version 3.2, you must use a build of rJava from TRAN. See that version's release notes for more information.

Perform this task in the TERR console or in TERR running under RStudio.

Procedure

  1. At the command prompt, type install.packages("rJava").
    Note that rJava is installed from CRAN to the site-library directory.
  2. At the command prompt, type library(rJava). For example:
    > library(rJava)
    The following object(s) are masked _from_ 'package:utils':
    
        head, str, tail
    The following object(s) are masked _from_ 'package:methods':
    
        new, show
    The following object(s) are masked _from_ 'base':
    
        anyDuplicated, duplicated, rev, sort, unique
    The rJava package is now in your search path.
  3. At the command prompt, type searchpaths(). For example:
    > searchpaths()
    [1] ".GlobalEnv"
    [2] "C:/Program Files/TIBCO/terr43/site-library/rJava"
    [3] "C:/Program Files/TIBCO/terr43/library/stats"
    [4] "C:/Program Files/TIBCO/terr43/library/graphics"
    [5] "C:/Program Files/TIBCO/terr43/library/grDevices"
    [6] "C:/Program Files/TIBCO/terr43/library/utils"
    [7] "C:/Program Files/TIBCO/terr43/library/methods"
    [8] "C:/Program Files/TIBCO/terr43/library/base"
    The absolute file path is returned for each package in the current environment. Note that by default, the newly-loaded rJava is listed second in the search path.