R - 无法安装xlsxjars,64位Windows但尝试加载i386

时间:2015-11-05 23:16:59

标签: java r 32bit-64bit xlsx xlconnect

我已经解决了这个问题太久了,欢迎任何帮助。我终于安装并加载了rJava,作为其中的一部分,我安装了64位JRE和JDK。 R版本3.2.2,64位,在64位Windows上运行7.想要安装xlsxjars(用于xlsx包)会产生一个很长的错误:

> install.packages("xlsxjars")
Installing package into ‘C:/Users/usr/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
installing the source package ‘xlsxjars’

trying URL 'https://cran.rstudio.com/src/contrib/xlsxjars_0.6.1.tar.gz'
Content type 'application/x-gzip' length 9477071 bytes (9.0 MB)
downloaded 9.0 MB

* installing *source* package 'xlsxjars' ...
** package 'xlsxjars' successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error : package 'rJava' is not installed for 'arch = i386'
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/usr/Documents/R/win-library/3.2/xlsxjars'
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\usr\Documents\R\win-library\3.2" C:\Users\usr\AppData\Local\Temp\RtmpEJnPPp/downloaded_packages/xlsxjars_0.6.1.tar.gz' had status 1
Warning in install.packages :
  installation of package ‘xlsxjars’ had non-zero exit status

The downloaded source packages are in
    ‘C:\Users\usr\AppData\Local\Temp\RtmpEJnPPp\downloaded_packages’

我很注重i386 vs 64架构,但我不确定这是不是现在的核心问题。我已经尝试手动将JAVA_HOME设置为下面的地址,并设置为=“”,但同样的错误也会出现。

> system("java -version")
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
> library(rJava)
> Sys.getenv("JAVA_HOME")
[1] "C:/Program Files/Java/jdk1.8.0_65/jre/"

我还安装了32位JDK以防止问题解决但没有骰子。这可能更多是关于Java而不是xlsxjars,因为我试图安装XLConnect作为一种解决方法但是出现了类似的错误:

> install.packages("XLConnect")
Installing package into ‘C:/Users/usr/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
also installing the dependency ‘XLConnectJars’

installing the source packages ‘XLConnectJars’, ‘XLConnect’

trying URL 'https://cran.rstudio.com/src/contrib/XLConnectJars_0.2-9.tar.gz'
Content type 'application/x-gzip' length 12946884 bytes (12.3 MB)
downloaded 12.3 MB

trying URL 'https://cran.rstudio.com/src/contrib/XLConnect_0.2-11.tar.gz'
Content type 'application/x-gzip' length 5151325 bytes (4.9 MB)
downloaded 4.9 MB

* installing *source* package 'XLConnectJars' ...
** package 'XLConnectJars' successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error : .onLoad failed in loadNamespace() for 'rJava', details:
  call: library.dynam("rJava", pkgname, libname)
  error: DLL 'rJava' not found: maybe not installed for this architecture?
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/usr/Documents/R/win-library/3.2/XLConnectJars'

1 个答案:

答案 0 :(得分:6)

解决,

install.packages("xlsx", INSTALL_opts="--no-multiarch")

Adi发现this question和Dason的子评论。