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

前端 未结 18 1775
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 04:50

    This line below has solved the same problem I was having with rJava package as some others in this discussion did. I'm sure there are more than one solution to this problem and I sincerely thank them all for their contributions because sometimes one line like the one below saves a lot of time from going to trash!

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

    I had the same problem and went through the same steps as you. The final step to allow starting RStudio through Finder/Spotlight was to link libjvm.dylib to /usr/local/lib:

    sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
    

    -f flag is added to force overwriting existing file/link

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

    Here is the easy steps for it:

    1. remove the rJava package: remove.packages(rJava)
    2. close R
    3. install latest Java on you mac
    4. open terminal and type this command: sudo R CMD javareconf
    5. Open R and install rJava with this command:

      install.packages("rJava", dependencies=TRUE, type="source")

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

    On macOS High Sierra (10.13.1) and Java Version 9 you have to use a slightly different JVM path (notice the missing jre folder in the path compared to the instructions for earlier Java versions):

    sudo ln -f -s $(/usr/libexec/java_home)/lib/server/libjvm.dylib /usr/local/lib
    

    You also have to notify R about the JVM:

    MY_R_VERSION=$(Rscript -e "cat(with(R.version, sprintf('%s.%s', major, substring(minor, 1, 1))))")
    ln -s /usr/local/lib/libjvm.dylib /Library/Frameworks/R.framework/Versions/$MY_R_VERSION/Resources/lib/
    
    0 讨论(0)
  • 2020-11-22 04:58

    The image not found issue exists with a brand-new install on OSX High Sierra with the latest Java SE 10 JDK.

    I was able to solve the path issue with rJava using the fix found on the rJava Github issues page: https://github.com/s-u/rJava/issues/78

    R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers

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

    I went through all the troubleshooting I could find, then installed jdk-11.0.1_osx-x64_bin.dmg from: Oracle downloads

    Everything worked perfectly after that.

    Check the version of the library that was not loaded when you run library('rJava') and match it to the java version you need installed.

    0 讨论(0)
提交回复
热议问题