Error onLoad failed in loadNamespace() for ‘rJava’

Published by onesixx on

https://stackoverflow.com/questions/28462302/libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory

 

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")

 

 

Categories: R Basic

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x