I have RStudio 1.1.419 running on a Mac OS El Capitan. I am trying to load the xlsx library. One of the dependencies is the rJava package. When I submit library(xlsx), I get the following error.
Loading required package: rJava 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.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 Error: package ‘rJava’ could not be loaded
I found this thread: Unable to load rJava on R
Based on that, I reinstalled Java and used Sys.setenv(JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java") to update the path. I am still getting the error.