从Java运行R脚本-Rconnection eval异常 [英] Running R script from java - Rconnection eval exception

查看:559
本文介绍了从Java运行R脚本-Rconnection eval异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何解决这个问题?我试图清空缓存,重新安装R和Rscript.

How can I solve this problem? I tried to empty cache, reinstall R and Rscript.

connection = new RConnection();

String path = "source('" + rScript.getFile().getAbsolutePath() + "')";

connection.eval(path);

//这行错误org.rosuda.REngine.Rserve.RserveException:eval 失败

// error in this line org.rosuda.REngine.Rserve.RserveException: eval failed

在源文件中,我有此代码

In a source file, I have this code

functionName <- function(param1, param2, ...,  paramN){
  #some code here
}

如果我删除functionName<-function(param1,param2,...,paramN){定义部分-可以使用.

If I remove functionName <- function(param1, param2, ..., paramN){ definition part - it works.

还在R控制台日志中出现此错误消息:

Also in R console log appeared this error message:

错误:尚不支持长向量:qap_encode.c:36致命错误: 无法初始化JIT

Error: long vectors not supported yet: qap_encode.c:36 Fatal error: unable to initialize the JIT

推荐答案

您还有这个问题吗?

我确实遇到了同样的问题,

I exactly had the same issue, which is

Error: long vectors not supported yet: qap_encode.c:36 Fatal error: unable to initialize the JIT

Error: long vectors not supported yet: qap_encode.c:36 Fatal error: unable to initialize the JIT

我目前正在使用Macbook(HighSierra)和R版本的3.5.0和Java 1.8.0.151.

I am currently using macbook (HighSierra) and R version of 3.5.0 and java 1.8.0.151.

我如何解决此问题,是要知道计算机上安装了哪个版本的Rserve.要检查Rserve的版本,请转到Rstudio并输入:

How I solve this issue is to know what version Rserve is installed on your computer. To check the version of Rserve, go to Rstudio and type:

packageVersion("Rserve")

,返回值将显示"Rserve"的版本.

and return value will show you the version of "Rserve".

如果返回值为1.7.3,那么我认为这是错误开始的地方.

If return value is 1.7.3, then I think this is the where error starts.

如果Rserve的版本是1.7.3,请尝试升级Rserve的版本.

If the version of Rserve is 1.7.3, then please try to upgrade your version of Rserve.

install.packages("Rserve", "Rserve_1.8-6.tgz", "http://www.rforge.net/")

此说明也可以在"Rforge"网站上找到: http://www.rforge.net/Rserve/files/. 当您单击此链接并向下滚动到存储库内容"时,它会写成小字体,显示请使用blah blah blah".这是"install.packages("Rserve,....)"的来源.

This instruction is also addressed on "Rforge" website: http://www.rforge.net/Rserve/files/. When you click this link and scroll down to "Repository contents", it is written in small font-size saying "please use blah blah blah". This is where the "install.packages("Rserve,....)" comes from.

我知道只有(至少在在线世界中)遇到或曾经遇到此问题,我花了2天的时间解决了这个问题.

I know that only few (at least on online-world) has or had faced this problem and I spent 2 days on solving this.

希望这对您有所帮助.

ps.根据您使用的操作系统,packageVersion()可能会有所不同.

ps. packageVersion() can be different based on the OS you use.

这篇关于从Java运行R脚本-Rconnection eval异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆