Mac 安装rJava出错,R library(rJava)出错

问题描述

下载Java for Mac安装后,然后install.packages("rJava"),R library(rJava)出错,错误描述如下:

错误: package or namespace load failed for ‘rJava’:
loadNamespace()里算'rJava'时.onLoad失败了,详细内容:
调用: dyn.load(file, DLLpath = DLLpath, ...)
错误: 无法载入共享目标对象‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so’::
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found

答案参见:
[1]: https://www.homeworkdone.net/question/4.html