RJava configuration error: one or more JNI types differ from the corresponding native type

A priori, my question may seem duplicated based on the name, but I tried all the answers in similar questions, and I was not able to solve the problem.

I am on mac 10.11.5, on R version 3.2.4 (2016-03-16).

My java version:

$ java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

and in mine .bash_profileyou will find:

# Java
export JAVA_HOME="`/usr/libexec/java_home -v 1.8`"

so that:

echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home

PROBLEM

Trying to use coreNLPor xlsxI get the following error messages:

> initCoreNLP()
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
Error in rJava::.jinit() : JNI_GetCreatedJavaVMs returned -1

> require(xlsx)
Loading required package: xlsx
Loading required package: xlsxjars
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
Error : .onLoad failed in loadNamespace() for 'xlsx', details:
  call: .jinit()
  error: JNI_GetCreatedJavaVMs returned -1

SEQUENTIAL Tricks :

1 based on what I read here I did:

$sudo R CMD javareconf
....
....
JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags    : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.

And then I tried to install it using both:

install.packages("rJava",type='source')

and dowloading rJava from here and:

 R CMD INSTALL rJava_0.9-9.tar.gz

Two return values:

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.

2- , .bash_profile:

export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib:$JAVA_HOME/jre/lib/server

:

$ls /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/server/
Xusage.txt    libjsig.dylib libjvm.dylib

, - .

3- simlink:

sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib

.

, , , . jre-XXX-macosx-x64.tar.gz jre, .

, "", , , - , .

UPDATE

, :

 export JAVA_HOME="`/usr/libexec/java_home -v 1.8`" 

.bash_profile.

, , .

+4

All Articles