我有一个load.R
尝试做的 R 脚本
load("test.RData")
当我运行时:
engine.eval(new FileReader("load.R"))
出现异常:
Exception in thread "main" java.lang.NoClassDefFoundError: org/tukaani/xz/XZInputStream
at org.renjin.primitives.io.connections.Connections.gzfile(Connections.java:79)
at org.renjin.primitives.R$primitive$gzfile.doApply(R$primitive$gzfile.java:75)
at org.renjin.primitives.R$primitive$gzfile.apply(R$primitive$gzfile.java:36)
at org.renjin.primitives.special.InternalFunction.apply(InternalFunction.java:45)
at org.renjin.eval.Context.evaluateCall(Context.java:302)
at org.renjin.eval.Context.evaluate(Context.java:222)
at org.renjin.eval.Context.evaluate(Context.java:163)
at org.renjin.sexp.Closure.doApply(Closure.java:83)
at org.renjin.eval.ClosureDispatcher.apply(ClosureDispatcher.java:73)
at org.renjin.eval.ClosureDispatcher.applyClosure(ClosureDispatcher.java:58)
at org.renjin.sexp.Closure.apply(Closure.java:78)
at org.renjin.eval.Context.evaluateCall(Context.java:302)
at org.renjin.eval.Context.evaluate(Context.java:222)
at org.renjin.primitives.special.AssignLeftFunction.assignLeft(AssignLeftFunction.java:57)
at org.renjin.primitives.special.AssignLeftFunction.apply(AssignLeftFunction.java:41)
at org.renjin.eval.Context.evaluateCall(Context.java:302)
at org.renjin.eval.Context.evaluate(Context.java:222)
at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:38)
at org.renjin.eval.Context.evaluateCall(Context.java:302)
at org.renjin.eval.Context.evaluate(Context.java:222)
at org.renjin.primitives.special.IfFunction.apply(IfFunction.java:40)
at org.renjin.eval.Context.evaluateCall(Context.java:302)
at org.renjin.eval.Context.evaluate(Context.java:222)
at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:38)
at org.renjin.eval.Context.evaluateCall(Context.java:302)
at org.renjin.eval.Context.evaluate(Context.java:222)
at org.renjin.eval.Context.evaluate(Context.java:163)
at org.renjin.sexp.Closure.doApply(Closure.java:83)
at org.renjin.eval.ClosureDispatcher.apply(ClosureDispatcher.java:73)
at org.renjin.eval.ClosureDispatcher.applyClosure(ClosureDispatcher.java:58)
at org.renjin.sexp.Closure.apply(Closure.java:78)
at org.renjin.eval.Context.evaluateCall(Context.java:302)
at org.renjin.eval.Context.evaluate(Context.java:222)
at org.renjin.eval.Context.evaluateExpressionVector(Context.java:285)
at org.renjin.eval.Context.evaluate(Context.java:220)
at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:145)
at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:104)
at com.infosistema.imp.restservice.data_treatment.DataTreatment.<init>(DataTreatment.scala:34)
at com.infosistema.imp.restservice.data_treatment.Main$.<init>(DataTreatment.scala:45)
at com.infosistema.imp.restservice.data_treatment.Main$.<clinit>(DataTreatment.scala)
at com.infosistema.imp.restservice.data_treatment.Main.main(DataTreatment.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: org.tukaani.xz.XZInputStream
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 46 more
我不知道 R。我只是尝试使用 R 代码在使用 Renjin 的 Java/Scala 应用程序中处理一些数据。
阅读文档上的数据部分,没有提到从.RData
文件中加载数据。
更新:
在我的build.sbt
文件中,我有:
resolvers += "BeDataDriven" at https://nexus.bedatadriven.com/content/groups/public",
libraryDependencies += "org.renjin" % "renjin-script-engine" % "0.8.1886"