> library(xlsx)
Error: package or namespace load failed for ‘xlsx’:
loadNamespace()里算'rJava'时.onLoad失败了,详细内容:
调用: fun(libname, pkgname)
错误: JAVA_HOME cannot be determined from the Registry
Error: package or namespace load failed for ‘xlsx’如何解决 - 简书 (jianshu.com)
java环境有问题,重新下载安装java https://www.java.com/zh-CN/download/
> install.packages("rJava")
将程序包安装入‘C:/Users/Kong Lab/AppData/Local/R/win-library/4.2’ (因为‘lib’没有被指定)
trying URL 'https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.2/rJava_1.0-6.zip' Content type 'application/zip' length 1245703 bytes (1.2 MB) downloaded 1.2 MB 程序包‘rJava’打开成功,MD5和检查也通过 下载的二进制程序包在 C:\Users\Kong Lab\AppData\Local\Temp\Rtmp4A3Tv2\downloaded_packages里
> install.packages("xlsxjars")
将程序包安装入‘C:/Users/Kong Lab/AppData/Local/R/win-library/4.2’ (因为‘lib’没有被指定)
trying URL 'https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.2/xlsxjars_0.6.1.zip' Content type 'application/zip' length 9485708 bytes (9.0 MB) downloaded 9.0 MB 程序包‘xlsxjars’打开成功,MD5和检查也通过 下载的二进制程序包在 C:\Users\Kong Lab\AppData\Local\Temp\Rtmp4A3Tv2\downloaded_packages里
> install.packages("xlsx")
将程序包安装入‘C:/Users/Kong Lab/AppData/Local/R/win-library/4.2’ (因为‘lib’没有被指定)
trying URL 'https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.2/xlsx_0.6.5.zip' Content type 'application/zip' length 374851 bytes (366 KB) downloaded 366 KB 程序包‘xlsx’打开成功,MD5和检查也通过 下载的二进制程序包在 C:\Users\Kong Lab\AppData\Local\Temp\Rtmp4A3Tv2\downloaded_packages里
> Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre1.8.0_311')
> library('rJava')
java.home option: JAVA_HOME environment variable: C:\Program Files\Java\jre1.8.0_311
Warning message: In fun(libname, pkgname) : Java home setting is INVALID, it will be ignored.
Please do NOT set it unless you want to override system settings.
> library(xlsx)
作者:小罗学生信
链接:https://www.jianshu.com/p/b9da84547c7d
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。