Installing rJava and xlsx are quite tricky as R is unable to load the JVM. Following are the list of errors and fixes for the same.

Error # tar: Failed to set default locale

tar: Failed to set default locale

Fix this by forcing the LANG.

$ defaults write org.R-project.R force.LANG en_US.UTF-8

Error # Unable to load libserver.dylib
In order to fix this you need to create a link for libserver.dylib in /usr/local/lib

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

Modify the java configuration

$ sudo R javareconf

Even after this if you are not able to load the rJava, please install with type=source option

>install.packages("rJava", type="source")
>libary("rJava")
>install.packages("xlsx")
>libary("xlsx")