Running R script from java - Rconnection eval exception

只愿长相守 提交于 2019-12-23 05:37:10

问题


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);

// 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
}

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

Also in R console log appeared this error message:

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


回答1:


Do you still have this issue?

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

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

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")

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

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

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/")

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.

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

Hope this helps you.

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



来源:https://stackoverflow.com/questions/50410289/running-r-script-from-java-rconnection-eval-exception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!