Reputation: 77
I'm trying to load the "openNLP" library in RStudio and I'm getting the following error. I get a similar error when I try to install the "RWeka" package.
How do I troubleshoot this?
library(openNLP)
Error : .onLoad failed in loadNamespace() for 'openNLPdata', details:
call: .jinit()
error: JNI_GetCreatedJavaVMs returned -1
Error: package or namespace load failed for ‘openNLP’
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
Upvotes: 0
Views: 1925
Reputation: 77
Found a solution to my issue. This is what worked for me. Please see below:
Launch R at the command line (to test the solution):
sudo R CMD javareconf
export LD_LIBRARY_PATH=$JAVA_LD_LIBRARY_PATH
LD_LIBRARY_PATH=$(/usr/libexec/java_home)/jre/lib/server: open -a RStudio
Now within RStudio:
install.packages("rJava", type = "source")
install.packages("openNLP")
require(rJava)
require(openNLP)
To launch RStudio from finder (El Capitan), you have to link libjvm.dylib
to /usr/lib
.
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
Upvotes: 3