Error onLoad failed in loadNamespace() for ‘rJava’

Published by onesixx on


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/': 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")



Categories: R Basic


Blog Owner

Leave a Reply

Your email address will not be published.