5

I have a package that uses "xlsx" as a dependency, and the package installs libraries fine if I do it from a local file. library(packagename) works fine, and so do library(xlsx) and library(rJava). We have just begun the process of implementing some badly needed version control, but, when trying to install the same package from a git repository, I get the following error:

devtools::install_git(path)

...

** building package indices
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'xlsx':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
Error : package 'xlsx' could not be loaded
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'

I also tried having rJava under Depends: in the DESCRIPTION listed before xlsx, and got the same error.

It seems other people have had the same error loading rJava, so I tried some of those suggestions (Problems when trying to load a package in R due to rJava).

System info:

> Sys.info()[c("sysname", "release", "version", "machine")]
         sysname              release              version              machine 
       "Windows" "Server >= 2012 x64"         "build 9200"             "x86-64" 

I've checked, and I'm definitely using 64-bit R

R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

And it appears that the Java version is also 64-bit.

> system("java -version")
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

I've also checked "JAVA_HOME"

> Sys.getenv("JAVA_HOME")
[1] ""
> Sys.getenv("JAVA")
[1] ""

I'm not sure why the package would work fine as a dependency in a local version of the package but not when installing from a repository. I know we could just add a library(xlsx) to all of our scripts to force solve this issue, but it would be nice to understand what is causing this issue.

Dave Gruenewald
  • 5,329
  • 1
  • 23
  • 35
Karen M.
  • 51
  • 4

0 Answers0