Cannot load R xlsx package on Mac OS 10.11
Unfortunately, these symlink tricks didn't help me. However, I found a similar issue on stackoverflow! (where else ;)) This one worked for me by doing the following:
-
In terminal enter the following to relink Java correctly:
sudo R CMD javareconf
-
Back in R (or RStudio) install the rJava package from source:
install.packages("rJava",type='source')
Hope, this helps!
I ´ve got also problems with loading packages like openNLP, xlsx, RWeka, ... and got the same error message like you.
But finally this command worked for me on OS X 10.11.3:
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
There might be a problem in the version of Java for which the R xlsx package was built in. Some old software require to install the Java 6 for OS X 10.11 El Capitan, OS X 10.10 Yosemite, OS X 10.9 Mavericks, OS X 10.8 Mountain Lion, and OS X 10.7 Lion. So you can try to install this old version of Java (Java for OS X 2015-001) at Apple website, link below: https://support.apple.com/kb/DL1572?locale=pt_BR&viewlocale=en_US
And check if you have a Java SE Development Kit 8. You can download it at Oracle website, link below: www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I was having the same problem and downloading the old version of Java solved it.. I hope this help you!
Basically, just do what is described here: https://oliverdowling.com.au/2015/10/09/oracles-jre-8-on-mac-os-x-el-capitan/
short version: d/l Java JRE from oracle as tar file http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
then put this into you terminal (for sudo, your pw is needed):
cd ~/Downloads
tar -xzf `ls -1r jre-*-macosx-x64.tar.gz | head -1`
cd `ls -1rd jre*/ | head -1`
defaults write `pwd`/Contents/Info.plist JavaVM -dict-add 'JVMCapabilities' '<array><string>JNI</string><string>BundledApp</string><string>CommandLine</string></array>'
plutil -convert xml1 Contents/Info.plist
sudo mv `pwd` /Library/Java/JavaVirtualMachines/
mkdir -p Contents/Home/bundle/Libraries
cd Contents/Home/bundle/Libraries
ln -s ../../lib/server/libjvm.dylib libserver.dylib
works fine on my OS X 10.11