Home > Java > javaTutorial > Why is rJava Failing to Load in RStudio After a macOS Yosemite Upgrade, and How Can I Fix It?

Why is rJava Failing to Load in RStudio After a macOS Yosemite Upgrade, and How Can I Fix It?

Mary-Kate Olsen
Release: 2024-12-15 18:35:14
Original
268 people have browsed it

Why is rJava Failing to Load in RStudio After a macOS Yosemite Upgrade, and How Can I Fix It?

rJava Loading Error in RStudio/R After Upgrading to macOS Yosemite

After upgrading to macOS Yosemite and R 3.2, users have encountered an error when loading rJava or dependent packages. The error message indicates an inability to load the shared object "rJava.so" due to missing library "libjvm.dylib."

Multiple attempts to resolve the issue have proved unsuccessful, including:

  • Installing Java 6
  • Reconfiguring Java with "sudo R CMD javareconf -n"
  • Setting "options('java.home')"
  • Reinstalling rJava from source

However, loading rJava from the command line succeeds without any errors. To alleviate the issue temporarily, users can open RStudio from the command line with the following code:

LD_LIBRARY_PATH=$(/usr/libexec/java_home)/jre/lib/server: open -a RStudio
Copy after login

This provides RStudio with the correct Java path.

To address the underlying problem and enable opening RStudio normally, it has been determined that linking the library "libjvm.dylib" to "/usr/local/lib" is necessary:

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

The "-f" flag ensures overwriting any existing file or link, resolving the load error for rJava and its dependent packages. This approach allows users to open RStudio in the conventional manner without requiring command line modifications.

The above is the detailed content of Why is rJava Failing to Load in RStudio After a macOS Yosemite Upgrade, and How Can I Fix It?. 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