问题描述
我无法在 R 3.0
中调用 rJava
包。我收到以下消息
I am not able to call rJava
package in R 3.0
. I got the following message
Error: package ‘rJava’ was built before R 3.0.0: please re-install it
当我尝试重新安装时遇到错误 rJava
包。我提供了输出 R CMD javareconf
I am getting error when I tried to re-install rJava
package. I have provided the output of R CMD javareconf
Java interpreter : /usr/bin/java
Java version : 1.7.0_21
Java home path : /usr/lib/jvm/java-7-openjdk-i386/jre
Java compiler : /usr/lib/jvm/java-7-openjdk-i386/jre/../bin/javac
Java headers gen.: /usr/lib/jvm/java-7-openjdk-i386/jre/../bin/javah
Java archive tool: /usr/lib/jvm/java-7-openjdk-i386/jre/../bin/jar
trying to compile and link a JNI progam
detected JNI cpp flags :
detected JNI linker flags :
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O2 -pipe -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 library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/lib/R
Done.
我使用的是Ubuntu 13.04。我也试过 apt-get install r-cran-rjava
,这无助于解决问题。关于jni.h,有一些解决方案但是,不确定我该如何在这里使用解决方案。
I am using Ubuntu 13.04. I also tried apt-get install r-cran-rjava
which is not helping to solve the issue. Regarding jni.h there were some solution here. But, not sure how can I use the solution here.
推荐答案
我遇到了完全相同的问题。我的解决方案是安装openjdk-7- *通过
I ran into the exact same issue. My solution was to install the openjdk-7-* via
sudo apt-get install openjdk-7-*
跟随
sudo R CMD javareconf
然后我可以通过<$ c $在R中安装rJava c> install.packages(rJava)。
虽然可能不是最优雅的解决方案但它似乎解决了我获取rJava的问题工作。
While perhaps not the most elegant solution it appears to have solved my problems with getting rJava to work.
这篇关于无法在Ubuntu 13.04中的R 3.0中安装rJava的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!