So I have tried the previously proposed answer to my question. but I am still having the same error message: I am trying to load the rJava library in R
rJava
What worked for me is explained here. Essentially, do sudo R CMD javareconf in the terminal and reboot.
sudo R CMD javareconf