The package xlsx need another package rJava
, which need JDK,
so you have to install JDK first, then config the path for RStudio,
then restart RStudio server to take effect:
`
sudo apt install openjdk-8-jdk
sudo R CMD javareconf
sudo rstudio-server restart
Ref: Error of java path on loading rJava package on SO.