Although I'm running the risk of duplicating questions, I have yet to find a solution to my configuration.
I'm trying to load rJava into RStudio.
I am using the latest Mac OS x, with a build of Rstudio that's only a couple of months old, and I've just installed JDK x64 12.0.1 The version of rJava is 0.9-11
On executing:
library(rJava)
I am confronted with the usual:
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.5/Resources/library/rJava/libs/rJava.so': dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.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.5/Resources/library/rJava/libs/rJava.so Reason: image not found
I've tried setting my Java home path to:
Sys.setenv(JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home')
But that doesn't make any difference.
I've clearly missed the rJava instructions somewhere which lays out how to install the package on all computer setups. I'd appreciate some assistance.
EDIT #1
Following the link provided in the comments below, I managed to get the latest version of Java JDK running through rJava in RStudio. The document "R, Java, rJava and macOS adventures" isn't complete and doesn't work off the cuff. You'll probably end up hacking about to get it working.
I needed rJava to run venneuler, unfortunately, this was not work using the latest Oracle JDK version 12:
WARNING: Initial Java 12 release has broken JNI support and does NOT work. Use stable Java 11 (or watch for 12u if available). ERROR: Java exception occurred during rJava bootstrap - see stderr for Java stack trace.
I'm going to try (wish me luck) to get two versions of Java on my machine and have RStudio recognise the right one.
Edit 2
install.packages(rJava)
first? – Jaapjava
installed in your Mac and correctly configured – FMM