0
votes

I have tried to install the R package JavaGDon MacOS 10.14.6. My R version is 3.6.1. When I do instal.packages there is apparently no error, but when I do in R console:

library(JavaGD) Error: package or namespace load failed for ‘JavaGD’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/JavaGD/libs/JavaGD.so': dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/JavaGD/libs/JavaGD.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/JavaGD/libs/JavaGD.so Reason: image not found

1
I am interested to hear what others suggest. My (basic, but possibly useful) advice would be to uninstall and reinstall javastevec
Are you sure this location exists: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylibOo.oO
It only exists now because I am installing jdk 11. Before I had jdk1.8.0_144.jdksbac
When running sudo R CMD javareconf ... I get clang-6.0: warning: no such sysroot directory: '/Applications/XCode/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/' [-Wmissing-sysroot] In file included from conftest.c:1: /Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home/include/jni.h:39:10: fatal error: 'stdio.h' file not found #include <stdio.h> ^~~~~~~~~ 1 error generated. make: *** [conftest.o] Error 1 Unable to compile a JNI programsbac

1 Answers

1
votes

It should work fine in macOS 10.14.

enter image description here

However, make sure your R and Java environments are correctly configured.

It might be a little bit of struggle to properly configure Java in R.

I suggest to start with simple Java code:

http://www.owsiak.org/r-java-11-and-making-sure-you-can-load-rjava/

to make sure you can actually use Java inside R.

In some cases it might be required to rebuild rJava package.

http://www.owsiak.org/r-3-4-rjava-macos-and-even-more-mess/

Anyway, I guess that first step is to make sure you can actually bind these two worlds.