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

前端 未结 18 1836
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:17

    This is how I configured it working properly on two Macs running Mac OS X El Capitan (10.11.6):

    1. Uninstall 'rJava' by issuing the following commands in a terminal window:

      Rscript -e 'remove.packages("rJava")'
      sudo Rscript -e 'remove.packages("rJava")'
      
    2. Download and install the Java software from Oracle: https://www.java.com/en/download/mac_download.jsp

    3. Add the following lines to /Users//.bashrc using your favorite editor:

      # Set JAVA_HOME so rJava package can find it
      export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)/jre
      
    4. Close and restart any terminal, R, and RStudio windows (to pick up the changes to .bashrc).

    5. Run the following command in a Terminal window:

      sudo ln -sf $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
      
    6. Run the following command in a Terminal window:

      sudo Rscript -e 'install.packages("rJava", repos="http://rforge.net", type="source")'
      

提交回复
热议问题