1、问题
在安装RWordReg包时出现如下错误:
> utils:::menuInstallPkgs()
installing the source package ‘Rwordseg’
试开URL’http://R-Forge.R-/src/contrib/Rwordseg_0.2-1.tar.gz'
Content type 'application/x-gzip' length 5445754 bytes (5.2 MB)
downloaded 5.2 MB
* installing *source* package 'Rwordseg' ...
** R
** demo
** inst
** preparing package for lazy loading
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: 无法载入共享目标对象‘D:/Program Files/R/R-3.2.2/library/rJava/libs/x64/rJava.dll’::
LoadLibrary failure: %1 不是有效的 Win32 应用程序。
Error : package 'rJava' could not be loaded
ERROR: lazy loading failed for package 'Rwordseg'
* removing 'D:/Program Files/R/R-3.2.2/library/Rwordseg'
下载的程序包在
‘C:\Users\NR\AppData\Local\Temp\RtmpCGvWIP\downloaded_packages’里
Warning messages:
1: 运行命令'"D:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "D:\Program Files\R\R-3.2.2\library" C:\Users\NR\AppData\Local\Temp\RtmpCGvWIP/downloaded_packages/Rwordseg_0.2-1.tar.gz'的状态是1
2: In install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :
安装程序包‘Rwordseg’时退出狀態的值不是0
2、解决
在R语言环境中设置JRE路径:
> Sys.setenv(JAVA_HOME='D:/jdk1.6.0_45/jre')
注意是JRE路径,而不是JDK的路径。