无法在 Ubuntu 13.04 的 R 3.0 中安装 rJava [英] Unable to install rJava in R 3.0 in Ubuntu 13.04
问题描述
我无法在 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 有一些解决方案 here. 但是,不确定我如何在这里使用解决方案.
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.
推荐答案
我遇到了完全相同的问题.我的解决方案是通过
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
然后我就可以通过 install.packages("rJava")
在 R 中安装 rJava.
and I was then able to install rJava in R via 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!