Explore Courses Blog Tutorials Interview Questions
0 votes
in R Programming by (5.3k points)

I'm trying to install rJava on a computer with Win 7 64 bit. When I run


everything seems to be fine:

Installing package(s) into ‘C:/Users/djq/Documents/R/win-library/2.13’

(as ‘lib’ is unspecified)

trying URL ''

Content type 'application/zip' length 654936 bytes (639 Kb)

opened URL

downloaded 639 Kb

package 'rJava' successfully unpacked and MD5 sums checked

The downloaded packages are in


but when I tried to load the library library(rJava) I get the following error:

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

  call: inDL(x, as.logical(local), as.logical(now), ...)

  error: unable to load shared object 'C:/Users/me/Documents/R/win-library/2.13/rJava/libs/x64/rJava.dll':

  LoadLibrary failure:  %1 is not a valid Win32 application.

Error: package/namespace load failed for 'rJava'

I have installed the Java JRE (trying both 32 and 64-bit versions) and the JDK (using both 32 and 64 bit). My R version is R version 2.13.1 (2011-07-08) and I'm using RStudio.

If I try using 32 bit R, I can load rJava fine. Is the problem just that rJava does not run in R 64 bit? How can I tell if a package is just for 32 instead of 64?

1 Answer

0 votes

To use rjava package for R(64-bit) version download and install Java SE Development Kit 8 for Windows x64 from here

Similarly for R (32-bit) version download and install Java SE Development Kit 8 for Windows x86 from here

To build or check R packages with multi-arch you need to install both Java For Windows x64 as well as Java for Windows x86. On Win 64, the former installs in C:\Program files\Java\ and the latter in C:\Program Files (x86)\Java\ so they do not conflict.

After completing the above process, install the binary package from CRAN. The binary package from CRAN automatically picks up on the jvm by itself


Browse Categories