Reputation: 11
So that I can use libraries dependent on rJava. When I try loading rJava, I get this:
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so': dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so Reason: image not found
So then I run
sudo R CMD javareconf
With this version of Java:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
Getting the following error:
trying to compile and link a JNI program
detected JNI cpp flags : -
I/System/Library/Frameworks/JavaVM.framework/Headers
detected JNI linker flags : -framework JavaVM
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -
I/System/Library/Frameworks/JavaVM.framework/Headers -
I/usr/local/include -fPIC -Wall -g -O2 -c conftest.c -o conftest.o
conftest.c:4:5: warning: 'JNI_CreateJavaVM' is deprecated
[-Wdeprecated-declarations]
JNI_CreateJavaVM(0, 0, 0);
^
/System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1937:1: note:
'JNI_CreateJavaVM' has been explicitly marked deprecated here
JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
Upvotes: 1
Views: 547
Reputation: 13405
On macOS there are issues with Java, R, and RStudio configuration. I have struggled with this one for some time.
You can find some info here: R, Java, rJava and macOS adventures
In general, you have to make sure to properly set Java, you need to enable JNI support for Java, you have to make sure to use Oracle's java instead of Apple's one (at least, for me, it's a preferred way of working with Java at macOS).
Upvotes: 0