先验我的问题可能看起来基于标题重复,但我在类似问题中尝试了所有答案,但我没有设法解决问题。
我在{10}上的Mac上,R version 3.2.4 (2016-03-16)
。
我的java版本:
$ java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
在.bash_profile
我会找到:
# Java
export JAVA_HOME="`/usr/libexec/java_home -v 1.8`"
这样:
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
问题
尝试使用coreNLP
或xlsx
我收到以下错误消息:
> initCoreNLP()
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.
Error in rJava::.jinit() : JNI_GetCreatedJavaVMs returned -1
> require(xlsx)
Loading required package: xlsx
Loading required package: xlsxjars
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.
Error : .onLoad failed in loadNamespace() for 'xlsx', details:
call: .jinit()
error: JNI_GetCreatedJavaVMs returned -1
FIX ATTEMPT :
1基于我所读的here我做了:
$sudo R CMD javareconf
....
....
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.
然后我尝试使用两者安装它:
install.packages("rJava",type='source')
并从here和
下载rJava R CMD INSTALL rJava_0.9-9.tar.gz
两人回来了:
checking JNI data types... configure: error: One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this.
2-根据我的阅读here我将此行添加到我的.bash_profile
:
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib:$JAVA_HOME/jre/lib/server
其中:
$ls /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/server/
Xusage.txt libjsig.dylib libjvm.dylib
但它也没有用,仍然是完全相同的错误。
3-我也尝试过简单的simlink:
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
再次没有奏效。
在这个阶段,我唯一可以尝试的是基于this。他们建议下载jre-XXX-macosx-x64.tar.gz
并替换现有jre
目录,如帖子中所述。
更新
我通过删除行解决了这个问题:
export JAVA_HOME="`/usr/libexec/java_home -v 1.8`"
来自.bash_profile
。
不知道为什么,但有效。