JGR on Mac OSX from R 3.4

The installation instructions for JGR on the deducer website (http://www.deducer.org/pmwiki/index.php?n=Main.MacOSXInstallation) work for R up-to version 3.3.

When you install R version 3.4 and follow the instructions on the Deducer website (http://www.deducer.org/), you get the following error:

library(JGR)

Loading required package: rJava

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

Error: package ‘rJava’ could not be loaded

You can install rJava with

install.packages(‘rJava’)

, but this doesn’t fix the problem. So, how to proceed?

 

Make sure Java is installed

 

The development toolkit from Oracle should be installed and can be downloaded from:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 

 

R needs to know were to find Java:

Open TERMINAL (not the R.App)

Enter:

R CMD javareconf

Now, still in TERMINAL, open R by entering

R

Next install rJava:

install.packages(“rJava”)

and enter:

library(JGR)

JGR()

And JGR should start up.

As mentioned on the CRAN website (https://cran.r-project.org/) it may be necessary to reinstall quartz (https://www.xquartz.org/).

JGR doesn’t start up from the R.App; you will need to start it from TERMINAL

You could also try to compile rJava from source,:

install.packages(“rJava”, type = “source”)