简体   繁体   English

在Mac OSX上运行的R Studio中安装rJava和xlsx

[英]Installing rJava and xlsx in R Studio running on Mac OSX

I am trying to install "xlsx" library in my R studio. 我正在尝试在R Studio中安装“ xlsx”库。 But since I was not having "rJava" installed, the installation didn't go through. 但是由于我没有安装“ rJava”,所以安装没有成功。

No when I am trying to install "rJava" after installing jdk in my mac, still I am getting the same error while installation, below is the error for both the libraries. 在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"

Getting rJava to be recognised seems to be a bit tricky. 使rJava被识别似乎有些棘手。 It looks as though R might be trying to look for it in the wrong place, in which case you could try the solutions to the similar question Error of java path on loading rJava package or the comments on Issue while connecting rJava in R Studio 似乎R可能试图在错误的位置寻找它,在这种情况下,您可以尝试解决以下类似问题的解决方案: 加载rJava包时出现java路径错误,或者在R Studio中连接rJava时出现有关Issue的注释

Depending on what you need the xlsx library for, the tidyverse series of packages have packages for reading and writing xlsx files which are not dependent on Java, see here 根据您需要xlsx库的需求,tidyverse系列软件包具有用于读取和写入不依赖Java的xlsx文件的软件包,请参见此处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM