Renjin could not find function 'engine.eval
<p>I am running Java on Linux (CentOS), via the command line.</p>

<p>When I put the R command is a separate file, described in Section 1.4 of <a href="http://docs.renjin.org/en/latest/introduction.html#evaluating-r-language-code" rel="nofollow">these docs</a>,</p>

<p>I get the error:</p>

<pre><code>Exception in thread "main" org.renjin.eval.EvalException: could not
find function 'engine.eval'
    at org.renjin.eval.Context.evaluateFunction(Context.java:269)
    at org.renjin.eval.Context.evaluateCall(Context.java:260)
    at org.renjin.eval.Context.evaluate(Context.java:193)
    at org.renjin.eval.Context.evaluateExpressionVector(Context.java:252)
    at org.renjin.eval.Context.evaluate(Context.java:191)
    at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:131)
    at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:127)
    at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:107)
    at pkg3.Temp3.main(Temp3.java:31)
</code></pre>

<p>I have the <code>CLASSPATH</code> set correctly, because:</p>

<pre><code>cd ~/rjtest
javac pkg3/Temp3.java

cd ~/rjtest
java pkg3.Temp3
</code></pre>

<p>produces:</p>

<pre><code>   x      y
 1  1      1.121
 2  2      0.525
 3  3      1.811
 4  4      1.914
 5  5      5.389
 6  6      8.501
 7  7      6.477
 8  8      7.805
 9  9      8.625
10 10     10.033

Call:
lm(formula = y ~ x, data = df)

Coefficients:
(Intercept) x
-0.902       1.113
</code></pre>

<p>Modifing the code to move the 3 <code>engine.eval</code> statements into <code>script.R</code>:</p>

<pre><code>// engine.eval("df &lt;- data.frame(x=1:10, y=(1:10)+rnorm(n=10))");
// engine.eval("print(df)");
// engine.eval("print(lm(y ~ x, df))");

engine.eval(new java.io.FileReader("/pathto/rjtest/pkg3/script.R"));
</code></pre>

<p>javac compiles with no error, but java gives the error.</p>