Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

QA: When I try to load the 'rJava' package using the 'library()' command, I get an error


View products that this article applies to.

Problem

When you try to load the 'rJava' package you get the error:

Error: .onLoad failed in loadNamespace() for 'rJava'

↑ Back to the top


Solution

Their are a number of environment variables and paths that need to be set on your system, in order for the 'rJava' package
to load successfully.

You should check the following on Windows:
  • Make sure that the environment variable 'JAVA_HOME' is set properly and points to a 64-bit version jof Java(JDK or SE
          Runtime). For 64-bit Revolution R you need to make sure that you have a 64-bit version of Java installed.
  • Make sure that the Java 'CLASSPATH' variable is set properly.
          For the 64-bit version of the JDK, this is typically set to something like the following(on Windows):
          'C:\Program Files\Java\jdk1.7.0_02\jre\lib\ext'
  • Check your system PATH settings. On Windows, goto 'Control Panel ---> System --> Advanced Settings ---> Environment Variables'.
          Your path should include the directories:   'C:\Program Files\Java\jre6\bin\server' and 'C:\Revolution\R-Enterprise-7.3\R-3.1.1\bin\x64'.
  • Make sure that the environment variables 'RPATH' and 'RHOME' are BOTH set and point to the directory:
          'C:\Revolution\R-Enterprise-7.3\R-3.1.1\bin\x64'
The same settings are required on Linux, however the paths will be different:
  • CLASSPATH:  /usr/java/jdk1.7.0_02/jre/lib/ext
  • RPATH and RHOME:  /usr/lib64/Revo-7.3/R-3.1.1
On Linux, it is also recommended that you run the command :

R CMD javareconf

This will attempt to configure Java properly on your system for use with Revolution R Enterprise.

Note that if not ALL of the configuration settings are filled out after running 'R CMD javareconf', this usually means that rJava won't work and your Java installation/configuration is insufficient.

↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 3103813
Revision : 1
Created on : 1/7/2017
Published on : 11/1/2015
Exists online : False
Views : 73