RJava won't load on rstudio server
I am using rstudio on ubuntu 12.4 server
with r 3.1.1
. Installing rJava successfully. But failed to load library rjava. I am using "rstudio" as a user.
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/rstudio/R/x86_64-pc-linux-gnu-library/3.1/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: package ‘rJava’ could not be loaded
But I could see the file in the mentioned declaration.
Also when I did this in Rstudio ...
>Sys.getenv("LD_LIBRARY_PATH")
[1] "/usr/lib/R/lib:/lib:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@:@JAVA_LD@"
When I did sudo R CMD javareconf
I got the next one
Java interpreter : /usr/bin/java
Java version : 1.6.0_32
Java home path : /usr/lib/jvm/java-6-openjdk-amd64/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
trying to compile and link a JNI progam
detected JNI cpp flags :
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c conftest.c -o conftest.o
conftest.c:1:17: fatal error: jni.h: No such file or directory
compilation terminated.
make: *** [conftest.o] Error 1
Unable to compile a JNI program
JAVA_HOME : /usr/lib/jvm/java-6-openjdk-amd64/jre
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/lib/R
Done.
Can anyone please help solve the problem.
Thanks, Amit
+3
source to share
4 answers
install rJava with unroot user
here is my successfully installed experience:
download the latest jdk and uncompressed then:
export JAVA_HOME=/public/software/jdk1.8.0_11/
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:/public/software/jdk1.8.0_11/lib/
~/soft/bin/R CMD INSTALL ~/soft/R/R_package_archive/rJava_0.9-6.tar.gz
done!
+1
source to share