libjvm.so: cannot open shared object file: No such file or directory
To solve this,
- Run
sudo R CMD javareconf
Add the following to to /etc/environment. This will then be set every time your machine restarts.
LD_LIBRARY_PATH=/usr/lib/jvm/default-java/jre/lib/amd64/server/
(change to your path)
- Run the following:
source /etc/environment
- rstudio server restart
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 stop2) export LD_LIBRARY_PATH=/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/jre/lib/amd64/default3) 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")
in case none of the above works, try this and thank me later (generic answer) :)
R CMD javareconf -eLD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JAVA_LD_LIBRARY_PATH