Skip to content
Advertisement

Renjin can’t load pckages

I’m a newbie with Renjin. I’m trying to use Renjin in a Java application. I’m trying to develop the example showed here.

I’m compiling with gradle, as recommended in the renjin’s web page.

So, with gradle build all is ok when I run gradle build.

Building with Renjin 0.8.2527
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:startScripts UP-TO-DATE
:distTar UP-TO-DATE
:distZip UP-TO-DATE
:assemble UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build UP-TO-DATE

BUILD SUCCESSFUL

Total time: 1.954 secs

But, when I want run the application with gradle run I get this.

Exception in thread "main" org.renjin.eval.EvalException: Could not load package a4Base; tried org.renjin.bioconductor:a4Base, org.renjin.cran:a4Base
        at org.renjin.primitives.packaging.NamespaceRegistry.getNamespace(NamespaceRegistry.java:131)
        at org.renjin.primitives.packaging.NamespaceRegistry.getNamespace(NamespaceRegistry.java:86)
        at org.renjin.primitives.packaging.Packages.library(Packages.java:23)
        at org.renjin.primitives.R$primitive$library.doApply(R$primitive$library.java:73)
        at org.renjin.primitives.R$primitive$library.apply(R$primitive$library.java:34)
        at org.renjin.primitives.special.InternalFunction.apply(InternalFunction.java:55)
        at org.renjin.eval.Context.evaluateCall(Context.java:270)
        at org.renjin.eval.Context.evaluate(Context.java:194)
        at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:46)
        at org.renjin.eval.Context.evaluateCall(Context.java:270)
        at org.renjin.eval.Context.evaluate(Context.java:194)
        at org.renjin.eval.Context.evaluate(Context.java:162)
        at org.renjin.sexp.Closure.doApply(Closure.java:108)
        at org.renjin.eval.ClosureDispatcher.apply(ClosureDispatcher.java:76)
        at org.renjin.eval.ClosureDispatcher.applyClosure(ClosureDispatcher.java:61)
        at org.renjin.sexp.Closure.apply(Closure.java:82)
        at org.renjin.eval.Context.evaluateCall(Context.java:270)
        at org.renjin.eval.Context.evaluate(Context.java:194)
        at org.renjin.eval.Context.evaluateExpressionVector(Context.java:253)
        at org.renjin.eval.Context.evaluate(Context.java:192)
        at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:150)
        at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:109)
        at com.flood.Statistics.testrenjin(Statistics.java:231)
        at com.flood.Flood.main(Flood.java:22)
:run FAILED

FAILURE: Build failed with an exception.

I’ve tried with different packages, with the same result. I searched the packages in the site http://packages.renjin.org/ and the packages exists, so I think isn’t about availability.

Anyone had the same problem? And solved it?

Thanks in advance.

Advertisement

Answer

You need to add the a4base package to your project.

With gradle, you can add the line:

dependencies {
    compile "org.renjin.bioconductor:a4Base:1.27.0-b3"
}

And Gradle will download the JAR and make it available to your application.

You can read more about using R packages with Java applications here:

http://docs.renjin.org/en/latest/library/using-packages.html

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement