6

I recently upgraded OSX from Mojave to Catalina. After the upgrade I couldn't run JGR() package in Rstudio because rJava could not be loaded. I repeatedly get the error:

    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.6/Resources/library/rJava/libs/rJava.so':
      dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/r        .Java/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.6/Resources/library/rJava/li        .bs/rJava.so
      Reason: image not found
    Error: package ‘rJava’ could not be loaded

Last time I had this problem (in OSX Mojave) I installed all packages using "install.packages("data", type = "binary"), however this doesn't solve the problem this time.

Can anyone help me and fix this problem? Any solutions how to proceed?

1
  • This question should not be closed since it is about Catalina.
    – cannin
    Commented Jan 14, 2020 at 19:08

2 Answers 2

2

Same problem with me after update Catalina. I tried many methods posted online, while none of them works.

According to the error message, it seems that Rstudio under Catalina could only run JDK11.0.1. So I uninstalled my JDK13.0.4 and then install the old version JDK11.0.1, and it works for me.

Maybe you can try install JDK11.0.1.

1
  • I had same error after Catalina and installing jdk 11.0.1 fixed it Commented Oct 24, 2019 at 0:25
2

I had the same problem after upgrading from Mojave to Catalina. Long story short, this is the only solution that worked for me:

In the terminal, use the following command

install_name_tool -change /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib \
    /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/jre/lib/server/libjvm.dylib \
    /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so
1
  • The folder structure looks different for java 1.6 -- would you know the comparable path? (there is no /jre and /lib doesn't have a /server folder)
    – J Kelly
    Commented Dec 7, 2019 at 19:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.