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:
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
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
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!