I'm encountering the same error message discussed in this question, which boils down to:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/anh/Rlibs/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
The problem is that following the answer there (i.e. setting LD_LIBRARY_PATH
to point to libjvm.so
) solved my issue in command-line R
, but Rstudio cannot find libjvm.so
still.
System specs: Ubuntu 14.04, R 3.1.1, Rstudio Desktop 0.98, apt-get install r-cran-rjava
done
Thanks to @hrbrmstr's comment, I searched for LD_LIBRARY_PATH
in RStudio Support forum and came across this solution.
The issue did boil down to Rstudio being unable to find libjvm.so
. I set LD_LIBRARY_PATH
in /etc/environment
, thus library(rjava)
can be loaded via terminal R. However, Rstudio doesn't look into etc/environment
and thus is not aware of LD_LIBRARY_PATH
.
The upshot: Set LD_LIBRARY_PATH
in ~/.profile
to make it available to all desktop application (as suggested by Ubuntu wiki article on persistent environment variable)
export LD_LIBRARY_PATH=/usr/lib/jvm/java-7-oracle/lib/amd64:/usr/lib/jvm/java-7-oracle/jre/lib/amd64/server
Then
sudo R CMD javareconf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With