R:无法在Ubuntu 12.04中安装rJava

时间:2014-04-09 17:46:52

标签: rstudio rjava

JAVA_HOME已在.bashrc中设置为jni.h所在的java-7-openjdk。 重新配置

时会覆盖输出JAVA_HOME
 lab@lab-Inspiron-N5010:~$ locate jni.h
 /usr/lib/jvm/java-7-openjdk-i386/include/jni.h

lab@lab-Inspiron-N5010:~$ echo $JAVA_HOME
/usr/lib/jvm/java-7-openjdk-i386/jre

lab@lab-Inspiron-N5010:~$ sudo R CMD javareconf
Java interpreter : /usr/bin/java
Java version     : 1.6.0_30
Java home path   : /usr/lib/jvm/java-6-openjdk-i386/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/i386/server -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
compilation terminated.
make: *** [conftest.o] Error 1
Unable to compile a JNI program


JAVA_HOME        : /usr/lib/jvm/java-6-openjdk-i386/jre
Java library path: 
JNI cpp flags    : 
JNI linker flags : 
Updating Java configuration in /usr/lib/R
Done.

R版本3.1.0 beta(2014-03-28 r65330)

尝试了所有建议的解决方案st R: rJava package install failing

Java版本详细信息

java version "1.6.0_30"
OpenJDK Runtime Environment (IcedTea6 1.13.1) (6b30-1.13.1-1ubuntu2~0.12.04.1)
OpenJDK Server VM (build 23.25-b01, mixed mode)

请帮助

[已解决]从ubuntu cran下载软件包解决了这个问题。 ubuntu cran

1 个答案:

答案 0 :(得分:0)

我有类似的错误以及导致此错误导致某些Java JDK设置未完成的原因,因此在我的情况下,我运行以下命令并成功完成安装

update-alternatives --display jar sudo update-alternatives --install“/ usr / bin / jar”“jar”“/ app / java / jdk1.7.0_51 / bin / jar”1 sudo update-alternatives --set jar /app/java/jdk1.7.0_51/bin/jar

update-alternatives --display javah sudo update-alternatives --install“/ usr / bin / javah”“javah”“/ app / java / jdk1.7.0_51 / bin / java”1 sudo update-alternatives --set javah /app/java/jdk1.7.0_51/bin/javah

您还可以使用以下链接找到所有Java变量的列表以及如何公开它们:

http://programmaticponderings.wordpress.com/2013/12/16/updating-oracles-pre-built-enterprise-java-vm-for-development/