0

I am trying to install rJava for my R enviroment.

I have tried this

$sudo locate libjvm.so
/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server/libjvm.so
/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so

$sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server/libjvm.so /usr/lib/

$sudo R CMD javareconf
Java interpreter : /usr/lib/jvm/default-java/jre/bin/java
Java version     : 1.7.0_79
Java home path   : /usr/lib/jvm/default-java
Java compiler    : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar

trying to compile and link a JNI program 
detected JNI cpp flags    : 
detected JNI linker flags : -L/usr/lib -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -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


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

In R side its showing this error

install.packages("rJava")

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.

If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.

ERROR: configuration failed for package ‘rJava’
* removing ‘’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

I believe this is the cause of the problem I some how installed two java environments and this is interfering with my rjava installation. How can i solve this.

Eka
  • 14,170
  • 38
  • 128
  • 212
  • I think this is unrelated to R. As long as your java configuration doesn't work, rJava cannot be installed. See, e.g., [here](http://stackoverflow.com/questions/14529720/how-to-make-jni-h-be-found) for more information on a problem that seems to be what you're describing. – RHertel Feb 27 '16 at 10:02
  • Thanks for your reply but I have to disagree with your statement its related to R as I am unable to install R package rJava other than that i am running other java appliction smoothly. any way tried this solution http://stackoverflow.com/a/14529804/996366 with my java version which is throwing another error `gcc: fatal error: no input files ` – Eka Feb 27 '16 at 15:35

0 Answers0