I have came across this problem while installing rJava on R3.0.1: "configure: error: One or more JNI types differ from the corresponding native type"
The detailed message is attached below. I searched for similar problems but my issue is a little trickier and many proposed solutions either didnt work or I could not try, because I am working on a server which I do not have write access to system libraries.
OS: Linux 2.6.18-348.6.1.el5 #1 SMP Tue May 21 15:44:27 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux (info given by typing "uname -a" sorry I couldn't quite understand this info)
R: R3.0.1, I downloaded the source, put in my home directory, and built R from source.
rJava: I ran 'install.packages("rJava")', during installation I got:
=========================
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver : '/usr/bin/jar'
compiler : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags : '-I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include -
I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include/linux'
java libs : '-L/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/lib/amd64/se
rver -ljvm'
checking whether JNI programs can be compiled... yes
checking JNI data types... configure: error: One or more JNI types differ from the
corresponding native type. You may need to use non-standard compiler flags or
a different compiler in order to fix this.
ERROR: configuration failed for package 'rJava'
* removing '/home/me/R-3.0.1/library/rJava'
==================================
Since I can only access the server remotely, I do not have write access to anything outside my home directory /home/me.
Any information would be highly appreciated!
I ran into the same problem trying to
install.packages("rJava")
in R version 3.0.2, as long as I tried to install as ordinary user (Linux, Debian). There was no problem runninginstall.packages("rJava")
as root. Then, tryinglibrary(rJava)
worked for root but not for me as a user:This problem required to add the environment variables
JAVA_HOME
andLD_LIBRARY_PATH
to~/.login
(following instructions found at Trouble in Setting Java Environment Path on Ubuntu (libjvm.so: cannot open shared object file: No such file or directory)):So, you would have to have a system administrator install rJava for you, then set your environment variables and, of course, set your own
.libPaths()
in R such as to find rJava.I hit the same issue on my mac OSx El Capitan. I tried updating the java paths/envs used by R using "R CMD javareconf" with no effects.
Finally, I saw that when I ran "R CMD javareconf" my Java library path: in the output was empty. By digging up further I figured out that my JAVA_HOME was not set correctly as pointed here https://stackoverflow.com/a/3311983 . I had to add an extra /jre in the JAVA_HOME path.
Using linux, specifically, 64 bit Gentoo, my solution was to add the following line to /etc/env.d/20java-config
Then
The above change needs to be made by root but then will apply to non-root users who use the same system, on next login.
Basically, rJava conf test was failing to find libjvm.so, the conftest program would compile but not link :)