Error loading rJava on Rstudio Server on Centos 6.5
I'm trying to load rJava in Rstudio Server 0.99.467 and Revolution Analytics Open R 3.2.0 (it's basically standard R 3.2.0 with some extra packages) and I get the following error
> require(rJava)
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/lib64/RRO-3.2.0/R-3.2.0/lib64/R/library/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
I am using Centos 6.5 and Oracle Java 1.8 JDK
[root@server ~]# java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
I was looking for a problem and one solution was to set JAVA_HOME to an empty string, however I already have this value set.
> Sys.getenv("JAVA_HOME")
[1] ""
Also I have two paths to the library if that might be causing the problem:
> .libPaths()
[1] "/home/kjedrzejewski/R/x86_64-unknown-linux-gnu-library/3.2"
[2] "/usr/lib64/RRO-3.2.0/R-3.2.0/lib64/R/library"
When I try to load this package in the R console in bash, no such error appears.
source to share
It all started when I ran the commands as root:
R CMD javareconf
rstudio-server verify-installation
I'm not sure what exactly helped.
In my case, the problem was that $ LD_LIBRARY_PATH, since it was available by Rstudio ( Sys.getenv('LD_LIBRARY_PATH')
), was pointing to a different java version than I was using.
source to share