[英]java version error for loading xlsx package in R
I have a lot of R scripts where xlsx package is used.我有很多 R 脚本,其中使用了 xlsx package。 When I use
library(xlsx)
to load it, I got java version errors like this:当我使用
library(xlsx)
加载它时,我得到了 java 版本错误,如下所示:
Error: package or namespace load failed for 'xlsx': .onLoad failed in loadNamespace() for 'xlsx', details: call: fun(libname, pkgname) error: Your java version is 12. Need 1.5.0 or higher. In addition: Warning message: package 'xlsx' was built under R version 3.5.2
I used sudo R CMD javareconf
to reset java versions to the right one, but still could not load xlsx correctly in Studio or R console. I used
sudo R CMD javareconf
to reset java versions to the right one, but still could not load xlsx correctly in Studio or R console. Oddly enough , when I run the same R scripts in Mac terminal command line, like, Rscript foo.R
, I can successfully load the library without errors.奇怪的是,当我在 Mac 终端命令行中运行相同的 R 脚本时,例如
Rscript foo.R
,我可以成功加载库而不会出错。 Somebody can help me to re-configure the Java in R console or Rstudio?有人可以帮我在 R 控制台或 Rstudio 中重新配置 Java 吗?
I am using MacOs Majave.我正在使用 MacOs Majave。 Thanks a lot!
非常感谢!
One way to skirt around the issue would be to use the tidyverse's readxl package , which doesn't require Java.绕过这个问题的一种方法是使用 tidyverse 的readxl package ,它不需要 Java。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.