Cannot install library(xlsx) in R and look for an

2019-01-20 13:08发布

I use R version 3.0.3. I was not able to install library(xlsx). Error message:

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:/Program Files/R/R-3.0.3/library/rJava/libs/x64/rJava.dll':

LoadLibrary failure:  The specified module could not be found.

I then tried to install rjava on its own. Got the error message below:

library("rJava", lib.loc="C:/Program Files/R/R-3.0.3/library") Error : .onLoad failed in loadNamespace() for 'rJava', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: unable to load shared object 'C:/Program Files/R/R-3.0.3/library/rJava/libs/x64/rJava.dll': LoadLibrary failure: The specified module could not be found.

Is there another way to load excel file in R?

Thanks,

标签: r xlsx rjava
5条回答
你好瞎i
2楼-- · 2019-01-20 13:22

For mac user, installing Java for OS X 2014-001 works for me https://support.apple.com/kb/DL1572?locale=en_US

查看更多
神经病院院长
3楼-- · 2019-01-20 13:26

For Windows 10 Pro users 64 bit OS, use

Sys.setenv(JAVA_HOME="C:\\Program Files\\Java\\jre1.8.0_144")
查看更多
We Are One
4楼-- · 2019-01-20 13:32

This problem is generally caused by x86 vs x64 bit differences between the R session and the install Java edition. By default Java installs the x86 version and you have to search for the x64 version. if you look at the version of Java you have installed and then open your R session to the same if your using R studio you can click on Tools.GlobalOptions and then select the version you need. ;-)

查看更多
beautiful°
5楼-- · 2019-01-20 13:35

See this and this. The last one is "The hard way: package xlsx" but it may still help you.

查看更多
孤傲高冷的网名
6楼-- · 2019-01-20 13:38

Here are some possible solutions:

  1. Install 64-bit version of Java. Here is the download link of Java.
  2. Re-install rJava.
  3. Manually set the directory of your Java location by setting it before loading the library

    Sys.setenv(JAVA_HOME="C:\\Program Files\\Java\\jre7") # for 64-bit version Sys.setenv(JAVA_HOME="C:\\Program Files (x86)\\Java\\jre7") # for 32-bit version library(rJava)

Source: here

查看更多
登录 后发表回答