Error onLoad failed in loadNamespace() for ‘rJava’
Error : .onLoad failed in loadNamespace() for 'rJava', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/local/lib/R/site-library/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory
sudo R CMD javareconf
I was getting the same error when I was trying to load rJava in RStudio. The following solution worked for me
1) sudo rstudio-server stop 2) export LD_LIBRARY_PATH=/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/jre/lib/amd64/default 3) sudo rstudio-server start
After performing the above steps, I was able to run the following successfuly in RStudio
> library("DBI") > library("rJava") > library("RJDBC")