简体   繁体   English

R:rJava包无法加载

[英]R: rJava package fails to load

I've installed the rJava pack successfully. 我已经成功安装了rJava包。 However, when I run the command library(rJava) , I get the following error. 但是,当我运行命令library(rJava) ,出现以下错误。

 > library(rJava) Error : .onLoad failed in loadNamespace() for 'rJava', details:   call: fun(libname, pkgname)   error: JAVA_HOME
 cannot be determined from the Registry Error: package or namespace
 load failed for ‘rJava’

How can I solve this issue? 我该如何解决这个问题?

I had this problem running XLConnect as well. 我在运行XLConnect时也遇到了这个问题。 It turned out that my instance of R was unable to see the Jave Virtual Machine on my 64 bit Windows computer at work. 原来,我的R实例无法在工作的64位Windows计算机上看到Jave虚拟机。 I simply found the 64 bit version of my jvm.dll file in the folder where it lives. 我只是在它所在的文件夹中找到了我的jvm.dll文件的64位版本。

You can just at the path to that .dll file to your library or require() function and it should undo the madness, although, in my case, I had to update Java completely because it was too old and set this at the beginning of my script to point to the JAVA home. 您可以只将该.dll文件添加到您的libraryrequire()函数的路径,并且应该消除这种疯狂,尽管就我而言,我必须完全更新Java,因为它太旧了,请在开始时进行设置。我的脚本指向JAVA主页。

Sys.setenv(JAVA_HOME="yourpathhere")

See if that works. 看看是否可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM