Skip to content

library(xlsx) fails with an error: Error: package ‘rJava’ could not be loaded

4 messages · John Sorkin, Miloš Žarković, Rainer Hurling +1 more

#
Windows 7 64-bit
R 3.1.3
RStudio 0.98.1103


I am having difficulty loading and installing the xlsx package. The
loading occurred without any problem, however the library command
library(xlsx) produced an error related to rJava. I tried to install
rJava seperately, re-loaded the xlsx package, and entered the
library(xlsx) command but received the same error message about rJave.
Please see terminal messages below. Any suggestion that would allow me
to load and run xlsx would be appreciated.
Thank you,
John
Installing package into ?C:/Users/John/Documents/R/win-library/3.1?
(as ?lib? is unspecified)
trying URL
'http://cran.rstudio.com/bin/windows/contrib/3.1/xlsx_0.5.7.zip'
Content type 'application/zip' length 400944 bytes (391 KB)
opened URL
downloaded 391 KB


package ?xlsx? successfully unpacked and MD5 sums checked


The downloaded binary packages are in
	C:\Users\John\AppData\Local\Temp\Rtmp4CO5m7\downloaded_packages
Loading required package: rJava
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/John/Documents/R/win-library/3.1/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  The specified module could not be found.


Error: package ?rJava? could not be loaded
Installing package into ?C:/Users/John/Documents/R/win-library/3.1?
(as ?lib? is unspecified)
trying URL
'http://cran.rstudio.com/bin/windows/contrib/3.1/rJava_0.9-6.zip'
Content type 'application/zip' length 759396 bytes (741 KB)
opened URL
downloaded 741 KB


package ?rJava? successfully unpacked and MD5 sums checked


The downloaded binary packages are in
	C:\Users\John\AppData\Local\Temp\Rtmp4CO5m7\downloaded_packages
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/John/Documents/R/win-library/3.1/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  The specified module could not be found.


Error: package or namespace load failed for ?rJava?
Loading required package: rJava
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/John/Documents/R/win-library/3.1/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  The specified module could not be found.


Error: package ?rJava? could not be loaded


John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and
Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing) 


Confidentiality Statement:
This email message, including any attachments, is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. Any unauthorized use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the
sender by reply email and destroy all copies of the original message.
#
Do you have 64-bit Java installed?

Regards
Milo?


On Saturday, April 18, 2015, John Sorkin <JSorkin at grecc.umaryland.edu>
wrote:
#
Hi John,

Am 18.04.2015 um 22:07 schrieb John Sorkin:
There are several possibilities, why your rJava does not find rJava.dll.
A good start give [1] to [3].

Did you have the right installation of JAVA itself?

I think, in your case, the JAVA installation itself should be the 64bit
version, and probably better version 1.8 than 1.7 [3] (someone please
correct me, if I am wrong here).

You get some hints about parameters with
R CMD javareconf --help

HTH.
Regards,
Rainer Hurling


[1]
http://cran.at.r-project.org/doc/manuals/r-release/R-admin.html#Java-support
[2]
http://cran.at.r-project.org/bin/windows/base/rw-FAQ.html#Loading-a-package-fails_002e
[3]
http://stackoverflow.com/questions/7019912/using-the-rjava-package-on-win7-64-bit-with-r
1 day later
#
You might want to try readxl instead, as it doesn't have any external
dependencies.
Hadley

On Sat, Apr 18, 2015 at 3:07 PM, John Sorkin
<JSorkin at grecc.umaryland.edu> wrote: