我试图安装rJava软件包(R 3.0.2,Ubuntu 14.04),我得到以下内容:
> install.packages('rJava')
...
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver : ''
compiler : '/usr/bin/javac'
header prep.: ''
cpp flags : ''
java libs : ''
configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
按照说明尽职地告诉我:
craig@craig-desktop:~$ sudo R CMD javareconf
Java interpreter : /usr/bin/java
Java version : 1.7.0_55
Java home path : /usr/lib/jvm/java-7-openjdk-i386/jre
Java compiler : /usr/bin/javac
Java headers gen.:
Java archive tool:
trying to compile and link a JNI progam
detected JNI cpp flags :
detected JNI linker flags : -L$(JAVA_HOME)/lib/i386/client -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -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
FWIW,我是从源代码构建R而不是使用软件包管理器,因为我需要最新版本。我已经尝试(重新)安装openjdk-7-jdk,r-cran-rjava,libnative-platform-jni和libatk-wrapper-java-jni(作为疯狂的猜测),但都无济于事。我需要什么才能让JNI工作?