R和Java具有不同的体系结构?我如何确定呢?

时间:2019-04-04 14:02:49

标签: java r

rJava已成功加载,并且包含在我的R库中。具有不同的体系结构意味着什么?请参阅下面的错误消息。

> library(glmulti)
Loading required package: rJava
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
Error: package ‘rJava’ could not be loaded

> install.packages("rJava")
Installing package into ‘C:/Users/mmsta/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://mirrors.nics.utk.edu/cran/bin/windows/contrib/3.5/rJava_0.9-11.zip'
Content type 'application/zip' length 828770 bytes (809 KB)
downloaded 809 KB
package ‘rJava’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
        C:\Users\mmsta\AppData\Local\Temp\Rtmpg7S7Sh\downloaded_packages

> library(rJava)
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
> 
> library(glmulti)
Loading required package: rJava
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
Error: package ‘rJava’ could not be loaded

谢谢。 MM

2 个答案:

答案 0 :(得分:1)

要运行R架构,请运行R.Version()$arch,要使Java版本运行,请java -version。对我来说,结果是:

R> R.Version()$arch
[1] "x86_64"
R>
$ java -version
openjdk version "1.8.0_144"
OpenJDK Runtime Environment (build 1.8.0_144-b01)
OpenJDK 64-Bit Server VM (build 25.144-b01, mixed mode)

R中_之后的数字必须与java输出中-Bit之前的数字相匹配。

答案 1 :(得分:0)

感谢鲍勃·詹森。

结果实际上比预期的要容易。我检查了Windows,Chrome,R和Java的64位版本。然后,在卸载JAVA下载页面顶部的32位版本的JAVA之后,我安装了JAVA安装网站底部的64位版本的JAVA。这就是匹配架构的含义。

我太快提出进一步的问题。始终在网络上搜索您遇到的错误消息很重要。

MM