Home > Java > javaTutorial > Why Can't I Load rJava in RStudio After My Yosemite Upgrade?

Why Can't I Load rJava in RStudio After My Yosemite Upgrade?

Linda Hamilton
Release: 2024-12-22 04:11:09
Original
147 people have browsed it

Why Can't I Load rJava in RStudio After My Yosemite Upgrade?

rJava Load Error in RStudio/R After Yosemite Upgrade

Users who upgraded their Mac operating system to Yosemite from Mountain Lion and their R version to 3.2 may encounter issues when attempting to load rJava in RStudio or R.

Upon upgrade, users may encounter a pop-up message prompting them to install Java 6. Additionally, loading rJava or dependent packages may result in RStudio crashing or the following error message:

Error : .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.2/Resources/library/rJava/libs/rJava.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rJava/libs/rJava.so
  Reason: image not found
Error: package or namespace load failed for ‘rJava’
Copy after login

Solution

To address this issue, users can create a symbolic link between libjvm.dylib and /usr/local/lib:

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

The -f flag forces overwriting any existing file or link. With the link established, users can successfully start RStudio without needing command line arguments and without experiencing the libjvm.dylib loading error.

The above is the detailed content of Why Can't I Load rJava in RStudio After My Yosemite Upgrade?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template