我正在尝试加载RStudio中的“openNLP”库,我收到以下错误。当我尝试安装“RWeka”软件包时,我收到类似的错误。
如何解决此问题?
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.
答案 0 :(得分:3)
找到解决我问题的方法。这对我有用。请参阅以下内容:
在命令行启动R(以测试解决方案):
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
现在在RStudio内:
install.packages("rJava", type = "source")
install.packages("openNLP")
require(rJava)
require(openNLP)
要从finder(El Capitan)发布RStudio,您必须将libjvm.dylib
与/usr/lib
相关联。
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib