错误:安装xlsx时无法加载包'rJava'

时间:2016-02-12 12:06:06

标签: r

我正在尝试安装xlsx包。安装工作正常,但是当我加载库时,我收到以下错误:

> require(xlsx)
Loading required package: xlsx
Loading required package: rJava
Error : .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.
 In addition: Warning messages:
 1: package ‘xlsx’ was built under R version 3.2.3 
 2: package ‘rJava’ was built under R version 3.2.3 
Failed with error:  ‘package ‘rJava’ could not be loaded’

我用Google搜索并说安装正确版本的Java可能是个问题。但是,当我下载最新版本并开始新的r-session时,我仍然遇到同样的问题。

是否有更多人遇到此问题?还有一些快速修复?

1 个答案:

答案 0 :(得分:0)

我正在使用Linux,当我更新R或Java以使用rJava库(xlsx需要)时,我需要从shell运行此命令(在R会话之外)

sudo su -
R CMD javareconf

我希望这会有所帮助。