我创建了一个 R 脚本“script.R”
df <- data.frame(x=1:10, y=(1:10)+rnorm(n=10))
print(df)
print(lm(y ~ x, df))
尝试在 Java 中使用 renjin 调用
engine.eval(new FileReader("src/javaSrc/script.R"));
得到以下异常:
Exception in thread "main" java.lang.NoSuchMethodError:
org.renjin.parser.RParser.parseSource(Lcom/google/common/io/CharSource;)Lorg/renjin/sexp/ExpressionVector;
at
org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:125)
at
org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:109)
at javaSrc.TryRenjin.main(TryRenjin.java:27)