Spotfire® Enterprise Runtime for R

Setting JAVA_HOME

Some packages that you use with TERR require access to Java on your system. If you call the TERR function Sys.getenv("JAVA_HOME") and it returns an empty string, you must set JAVA_HOME so the packages can access Java.

About this task

Perform this task on your Windows Or Linux system.

Before you begin

The following list describes a few of the packages that are either provided with TERR or that you can use with TERR, but they require a bit-matching 32-bit or 64-bit version of Java, version 6 or later. (You might find other packages that require Java. These instructions can help you prepare your TERR session for those packages, too.)
Package name Provided in your TERR installation
parallel yes
sjdbc yes
terrJava yes
rJava no
Note: See Installing the rJava package for more information.

Procedure

  1. Locate your Java installation and make a note of it.
    Tip: Your system can have more than one version of Java. Generally, use the latest version. On Windows, you can find this path in the registry. On Linux, you can usually find a link to it in the \user\bin directory.
    For example, on Windows, this path might be C:/Program Files/jdk-11.0.1.
  2. Start a session of the TERR console.
  3. At the TERR command prompt, type the command Sys.setenv(JAVA_HOME="path_to_ your_Java_installation") where path_to_ your_Java_installation is the path you noted in Step 1.
    For example, on Windows, this call might look like the following.
    > Sys.setenv(JAVA_HOME="C:/Program Files/jdk-11.0.1")

    On Linux, this call might look like the following.

    > Sys.setenv(JAVA_HOME="/usr/lib/jvm/java-11-sun/"
    Your system environment JAVA_HOME is now set to the specified Java installation.
  4. Optional: Check the setting for JAVA_HOME from TERR by typing Sys.getenv("JAVA_HOME").
    For example, on Windows, it might look like the following.
    > Sys.getenv("JAVA_HOME")
    [1] "C/Program Files/jdk-11.0.1"

What to do next

Install the package that requires setting JAVA_HOME. For an example, see Installing the rJava package.