我正在尝试在R Studio中安装“ xlsx”库。但是由于我没有安装“ rJava”,所以安装没有成功。
否,当我在Mac中安装jdk之后尝试安装“ rJava”时,在安装过程中仍然出现相同的错误,以下是两个库的错误。
"Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
Reason: image not found"
"Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
Reason: image not found"
答案 0 :(得分:0)
要使rJava受到认可似乎有些棘手。似乎R可能试图在错误的位置寻找它,在这种情况下,您可以尝试解决类似问题或对Error of java path on loading rJava package的评论
tidyverse系列软件包会根据您需要xlsx库的内容提供用于读取和写入不依赖Java的xlsx文件的软件包,请参见Issue while connecting rJava in R Studio