[R-SIG-Mac] Issues with rJava on OS X El Capitan

Berend Hasselman bhh at xs4all.nl
Sun Feb 14 12:47:27 CET 2016


> On 14 Feb 2016, at 12:31, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> 
> On 14/02/2016 11:24, Berend Hasselman wrote:
>> 
>>> On 14 Feb 2016, at 11:48, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
>>> 
>>> Your Java is seriously old.  Start by updating it (1.8.0_74 is current, AFAIK).
>>> 
>>> I can reproduce this with the CRAN binary packages, but installing the packages from source works for me on El Capitan (using the CRAN binary R).  So I suspect a problem with the CRAN binary package of rJava, which seems to be hard-coded to use /System/Library/Frameworks/JavaVM.framework and not Oracle Java.
>>> 
>> 
>> I've just updated to Java 1.8.0_74.
>> I get the same issues.
>> 
>> 
>> And I have now also installed rJava, XLConnect end XLConnectJars from source.
>> library(XLConnect) gives this error
>> 
>> <message>
>> Loading required package: XLConnectJars
>> Error : .onLoad failed in loadNamespace() for 'rJava', details:
>>   call: dyn.load(file, DLLpath = DLLpath, ...)
>>   error: unable to load shared object '/Users/berendhasselman/Library/R/3.2/library/rJava/libs/rJava.so':
>>   dlopen(/Users/berendhasselman/Library/R/3.2/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib
>>   Referenced from: /Users/berendhasselman/Library/R/3.2/library/rJava/libs/rJava.so
>>   Reason: image not found
>> Error: package 'XLConnectJars' could not be loaded
>> </message>
>> 
>> Apparently rJava.so can't be found. But I had already installed it from source.
> 
> That is not what the message says ... it is libjvm which is not being found.
> 

Correct. Sorry about that.

> Did you re-run R CMD javareconf?  (You might need to reinstall rJava from source once you do.)
> 

Yes I did and have done so again. I've reinstalled rJava from source and get the same error and the same output of running otool -L  on rJava.so.

Berend

Output of R CMD javareconf:

Java interpreter : /usr/bin/java
Java version     : 1.8.0_74
Java home path   : /Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre
Java compiler    : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Non-system Java on OS X

trying to compile and link a JNI program 
detected JNI cpp flags    : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/../include/darwin -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c conftest.c -o conftest.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation


JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk1.8.0_74.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.



> 
>> I have run otool on the installed rJava.so
>> 
>> otool -L rJava.so
>> rJava.so:
>> 	rJava.so (compatibility version 0.0.0, current version 0.0.0)
>> 	@rpath/libjvm.dylib (compatibility version 1.0.0, current version 1.0.0)
>> 	/Library/Frameworks/R.framework/Versions/3.2/Resources/lib/libR.dylib (compatibility version 3.2.0, current version 3.2.3)
>> 	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1256.14.0)
>> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
>> 
>> Berend
>> 
>>> On 14/02/2016 09:22, Berend Hasselman wrote:
>>>> I have installed rJava, xlsx, xlsxjars, XLConnect and XLConnectJars.
>>>> 
>>>> Executing library(xlsx) gives this output
>>>> 
>>>> Loading required package: rJava
>>>> Loading required package: xlsxjars
>>>> Error : .onLoad failed in loadNamespace() for 'xlsx', details:
>>>>   call: .jinit()
>>>>   error: JNI_GetCreatedJavaVMs returned -1
>>>> 
>>>> Error: package or namespace load failed for 'xlsx'
>>>> 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.
>>>> 
>>>> 
>>>> Executing library(XLConnect) gives this output
>>>> 
>>>> Loading required package: XLConnectJars
>>>> Error : .onLoad failed in loadNamespace() for 'XLConnectJars', details:
>>>>   call: .jinit()
>>>>   error: JNI_GetCreatedJavaVMs returned -1
>>>> 
>>>> Error: package 'XLConnectJars' could not be loaded
>>>> 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.
>>>> 
>>>> 
>>>> sessionInfo (after library(xlsx) and library(XLConnect)) and javareconf output below.
>>>> 
>>>> What is going on?
>>>> What is the solution for this problem?
>>>> 
>>>> Berend Hasselman
>>>> 
>>>> 
>>>> SessionInfo:
>>>> 
>>>> R version 3.2.3 Patched (2016-02-13 r70160)
>>>> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>>>> Running under: OS X 10.11.3 (El Capitan)
>>>> 
>>>> locale:
>>>> [1] en_IE.UTF-8/en_IE.UTF-8/en_IE.UTF-8/C/en_IE.UTF-8/en_IE.UTF-8
>>>> 
>>>> attached base packages:
>>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>> 
>>>> other attached packages:
>>>> [1] xlsxjars_0.6.1 rJava_0.9-8
>>>> 
>>>> loaded via a namespace (and not attached):
>>>> [1] tools_3.2.3
>>>> 
>>>> 
>>>> Output of R CMD javareconf
>>>> 
>>>> [.../~]: R CMD javareconf -n
>>>> Java interpreter : /usr/bin/java
>>>> Java version     : 1.8.0_25
>>>> Java home path   : /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
>>>> Java compiler    : /usr/bin/javac
>>>> Java headers gen.: /usr/bin/javah
>>>> Java archive tool: /usr/bin/jar
>>>> Non-system Java on OS X
>>>> 
>>>> trying to compile and link a JNI program
>>>> detected JNI cpp flags    : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
>>>> detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
>>>> clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/../include/darwin -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c conftest.c -o conftest.o
>>>> clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
>>>> 
>>>> JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk1.8.0_25.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
>>>> 
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>> 
>>> 
>>> 
>>> --
>>> Brian D. Ripley,                  ripley at stats.ox.ac.uk
>>> Emeritus Professor of Applied Statistics, University of Oxford
>> 
> 
> 
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Emeritus Professor of Applied Statistics, University of Oxford



More information about the R-SIG-Mac mailing list