Home >Java >javaTutorial >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’
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
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!