I had some problems installing the R package xlsx due to a failure from R not being able to find the Java runtime. I found a pretty quick fix for it on Stack Overflow that simply involved running
sudo R CMD javareconf
the command line. Quick and simple.