[R] Java, rJava, and Windows x64

Simon Urbanek simon.urbanek at r-project.org
Wed Jan 9 17:36:09 CET 2013

On Oct 29, 2012, at 11:17 AM, Robert Baer wrote:

> When running [1] "R version 2.15.1 (2012-06-22)" "x86_64-pc-mingw32", rJava fails. I have installed both the 32-bit and 64-bit versions of Java 7 update 9.
> > library(rJava)
> Error : .onLoad failed in loadNamespace() for 'rJava', details:
> call: stop("No CurrentVersion entry in '", key, "'! Try re-installing Java and make sure R and Java have matching architectures.")
> error: object 'key' not found
> Error: package/namespace load failed for ‘rJava’
> >
> It appears that rJava was not seeing the x64 Java. For clarity, I installed the 32-bit java library second, and I imagined this might be the problem. The Java installer told me that it was already present, and the x64 library appeared to be working with the 64-bit IE9 browser
> Indeed, reinstalling Java x64, the rJava package iloaded fine with the library(rJava) command in 64-bit R. rJava could STILL be loaded with library(rJava) within x86 R.
> My question is, should the order of Java installation affect the ability of rJava to load under 64-bit R? Are there environmental variables or registry settings that should be checked in such cases or is it literally necessary to do a complete reinstall?

The registries are completely separate for 32-bit and 64-bit so installing 32-bit Java doesn't affect 64-bit R and vice-versa. rJava is simply checking the registry that is has access to and it is the one corresponding to the R process (so 32-bit R will check 32-bit registry and 64-bit R will check the 64-bit registry). It is looking for either of Software\JavaSoft\Java Runtime Environment or Software\JavaSoft\Java Development Kit registry tree.


PS: Please uses stats-rosuda-devel mailing list for rJava questions.

More information about the R-help mailing list