I am trying to use rJava library in Rstudio server env. When I issue:
library(rJava)
I keep getting this error:
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/opt/microsoft/ropen/3.5.1/lib64/R/library/rJava/libs/rJava.so':
libjvm.so: wrong ELF class: ELFCLASS32
I verified that java and R distribution is both 64 bit.
R.Version()
$system
[1] "x86_64, linux-gnu"
java -version:
Java HotSpot(TM) 64-Bit Server VM
I do see the file by doing ls:
ls -l /opt/microsoft/ropen/3.5.1/lib64/R/library/rJava/libs/rJava.so
-rwxr-xr-x 1 root root 365280 Sep 20 15:31 /opt/microsoft/ropen/3.5.1/lib64/R/library/rJava/libs/rJava.so
Any ideas what is going on here?
I executed what user @megatron recommended
sudo R CMD javareconf
I get this error:
trying to compile and link a JNI program
detected JNI cpp flags :
detected JNI linker flags :
gcc -std=gnu99 -I/opt/microsoft/ropen/3.5.1/lib64/R/include -DNDEBUG -DU_STATIC_IMPLEMENTATION -fpic -DU_STATIC_IMPLEMENTATION -O2 -g -c conftest.c -o conftest.o
conftest.c:1:17: fatal error: jni.h: No such file or directory
#include <jni.h>
^
compilation terminated.
make: *** [conftest.o] Error 1
Unable to compile a JNI program