Error: package or namespace load failed for ‘rJava’:

https://stackoverflow.com/questions/30738974/rjava-load-error-in-rstudio-r-after-upgrading-to-osx-yosemite

 

安装好的“xlsx”不能正常加载

library("xlsx")

报错:

载入需要的程辑包:rJava
Error: 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
错误: 无法载入程辑包‘rJava’

 

解决方法:

 

sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib

After that, in RStudio, loading rJava works through loading of the "xlsx" package.

 

posted @ 2017-10-11 10:41  圆旭  阅读(5254)  评论(0编辑  收藏  举报