.onLoad在'rJava的loadNamespace()中失败

时间:2019-10-11 19:32:10

标签: r rjava

我正在使用Java版本1.8.0.221运行Win 10 64-bi。加载xlsx软件包时,在R Studio 3.5.2版(也为64位)中出现错误。 错误在于加载rJava。 关于如何解决此问题的任何想法?我被困住了,无法前进。谢谢。

trying URL 'https://mran.microsoft.com/snapshot/2019-02-01/bin/windows/contrib/3.5/xlsx_0.6.1.zip'
Content type 'application/zip' length 458979 bytes (448 KB)
downloaded 448 KB

package ‘xlsxjars’ successfully unpacked and MD5 sums checked
package ‘xlsx’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\<user>\AppData\Local\Temp\RtmpIZaYPe\downloaded_packages
> library(xlsx)
Error: package or namespace load failed for ‘xlsx’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/<user>/Documents/R/win-library/3.5/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  The specified module could not be found.

1 个答案:

答案 0 :(得分:0)

我添加了以下内容,然后正确加载了rJava。

Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_221')