我正在使用ubuntu 12.4 server
rstudio r 3.1.1
。成功安装 rJava。但无法加载 rjava 库。我正在使用“rstudio”作为用户。
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
但我可以在提到的位置看到文件。
当我在 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@"
当我这样做时,sudo R CMD javareconf
我得到了关注
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.
任何人都可以请帮助解决这个问题。
谢谢,阿米特