RConnection c = new RConnection();
// REXP x = c.eval("source('D:\\\\jiaoben\\\\RJava_test.R',encoding = \"UTF-8\")");
REXP x = c.eval("source('D:\\\\jiaoben\\\\Rjava_testx6.R',encoding = \"UTF-8\")");
// REXP eval = c.eval("running()");
REXP eval = c.eval("iscompleted()");
System.out.println(eval.asString());



脚本内容

library(Rserve)
Rserve()

Sys.sleep(5)
message("The Task is Finished Successfully!")

iscompleted <- function(){
return("The Task is Finished Successfully!")
}

    如果R连接拒绝,要在R中开启Rserve  

              打开Rstudio后会出现JAVA调用不了脚本的情况,关了就好了,待大家发掘

网上关于windows路径的资料太少,试验了好久

相关文章:

  • 2022-02-09
  • 2021-11-26
  • 2021-11-26
  • 2021-08-27
  • 2021-12-23
  • 2021-11-05
  • 2021-11-13
  • 2022-12-23
猜你喜欢
  • 2021-07-15
  • 2022-12-23
  • 2021-11-20
  • 2021-12-31
  • 2021-07-22
  • 2021-06-21
  • 2022-12-23
相关资源
相似解决方案