2

JAVA_HOME has been set in .bashrc to java-7-openjdk where jni.h is located. The output JAVA_HOME is overridden when reconfigured

 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 version 3.1.0 beta (2014-03-28 r65330)

Tried all solutions suggested st R: rJava package install failing

Java version details

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)

Kindly help

[SOLVED] Downloading the packages from ubuntu cran solved the issue. ubuntu cran

Community
  • 1
  • 1
user1142937
  • 314
  • 5
  • 19

1 Answers1

0

I have similar error and the reason for this error that some of the Java JDK settings are not done, so in my case I run the following commands and the installation completed successfully

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/javah" 1 sudo update-alternatives --set javah /app/java/jdk1.7.0_51/bin/javah

also you can find the list of all Java variables and how to expose them using the below link:

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

Safwat
  • 11
  • 2