我正在尝试rJava
在具有Win 7 64位的计算机上安装。当我跑步
install.packages("rJava")
一切似乎都很好:
Installing package(s) into ‘C:/Users/djq/Documents/R/win-library/2.13’
(as ‘lib’ is unspecified)
trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.13/rJava_0.9-1.zip'
Content type 'application/zip' length 654936 bytes (639 Kb)
opened URL
downloaded 639 Kb
package 'rJava' successfully unpacked and MD5 sums checked
The downloaded packages are in
C:\TEMP\RtmpW2eAUw\downloaded_packages
但是当我尝试加载库时library(rJava)
,出现以下错误:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/me/Documents/R/win-library/2.13/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error: package/namespace load failed for 'rJava'
我已经安装了Java JRE(尝试32和64位版本)和JDK(使用32和64位版本)。我的R版本是R version 2.13.1 (2011-07-08)
,我正在使用RStudio。
如果尝试使用32位R,则可以正常加载rJava
。问题rJava
不是仅在R 64位中运行吗?我如何确定一个软件包是否仅适用于32个而不是64个?
编辑:刚刚发布R.version()
:
> R.Version()
$platform
[1] "x86_64-pc-mingw32"
$arch
[1] "x86_64"
$os
[1] "mingw32"
$system
[1] "x86_64, mingw32"
$status
[1] ""
$major
[1] "2"
$minor
[1] "13.1"
$year
[1] "2011"
$month
[1] "07"
$day
[1] "08"
$`svn rev`
[1] "56322"
$language
[1] "R"
$version.string
[1] "R version 2.13.1 (2011-07-08)"
Program Files
或中Program Files (x86)
。按照接受的答案说,向Windows添加路径。如果为Program Files (x86)
,则表示您使用的是32位版本,请访问以下链接:sites.google.com/site/rforfishandwildlifegrads/home/week_2/…。
R.Version()
到您的问题吗?我刚刚rJava
使用您在问题中描述的确切方法安装了64位版本。我的猜测是您的R版本是32位。