rJava load error in RStudio/R after “upgrading” to OSX Yosemite

前端 未结 18 1827
Happy的楠姐
Happy的楠姐 2020-11-22 04:23

I recently \"upgraded\" from OSX Mountain Lion to Yosemite and from R 3.1.3 to 3.2. Immediately after the upgrade, when I opened R or RStudio I got a pop-up message saying t

相关标签:
18条回答
  • 2020-11-22 05:03

    Maybe another simple answer which does not touch your filesystem:

    $ install_name_tool -add_rpath /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/server /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so

    (Substitute jdk1.8.0_131.jdk with your JDK path.)

    0 讨论(0)
  • 2020-11-22 05:03

    Here you can download the legacy Java version 6 for El Capitan: https://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US After doing so, the rJava package works for me.

    0 讨论(0)
  • 2020-11-22 05:04

    On OSX El Capitan 10.11, the user doesn't have permission to write to /usr/lib. So instead, use the following command:

    sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
    
    0 讨论(0)
  • 2020-11-22 05:05

    Run the following on the command line: sudo R CMD javareconf

    Several solutions above have mentioned this, but they also suggest that one remove and subsequently re-install the rJava package. I found those additional steps to be unnecessary.

    0 讨论(0)
  • 2020-11-22 05:10

    You should be able to use the CRAN rJava, without needing to recompile rJava or do any additional steps by linking the shared library to the R frameworks library directory.

    sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /Library/Frameworks/R.framework/Libraries
    
    0 讨论(0)
  • 2020-11-22 05:10

    Check the location of libjvm.dylib file.

    Try this, in my case this worked:

    dyn.load('/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/lib/server/libjvm.dylib')
    library(rJava)
    
    0 讨论(0)
提交回复
热议问题