3.1. Project Setup

Renjin is a essentially a Java library that allows you to evaluate scripts written in the R language. This library must be added as dependency to your project.

3.1.1. Maven

For projects organized with Apache Maven, you can simply add Renjin’s Script Engine as dependency to your project:


where For this to work you will also need to add BeDataDriven’s public repository to your pom.xml:

    <name>bedatadriven public repo</name>

You can use RELEASE instead of “3.5-beta76” in the project file to use the very latest versions of the Renjin components.

3.1.2. Gradle

For projects organized with Gradle, add the following to your build.gradle file:

repositories {
  maven { url "https://nexus.bedatadriven.com/content/groups/public" }

dependencies {
  compile "org.renjin:renjin-script-engine:3.5-beta76";

See the renjin-gradle-example on GitHub for a complete example.

3.1.3. Scala Build Tool (SBT)

The following is an example of build.sbt that includes Renjin’s Script Engine:

// IMPORTANT: sbt may fail if http*s* is not used.
resolvers +=
    "BeDataDriven" at "https://nexus.bedatadriven.com/content/groups/public"

// Workaround for buggy http handler in SBT 1.x
// https://github.com/sbt/sbt/issues/3570
// Do not include for SBT 0.13.x or earlier
updateOptions := updateOptions.value.withGigahorse(false)

lazy val root = (project in file(".")).
    name := "renjin-test",
    version := "1.0",
    scalaVersion := "2.10.6",
    libraryDependencies += "org.renjin" % "renjin-script-engine" % "3.5-beta76"

See the renjin-sbt-example on GitHub for a complete example.


There has been a report that the coursier plugin fails to resolve Renjin’s dependencies. If you encounter class path problems with the plugin, try building your project without.

3.1.4. Eclipse

We recommend using a build tool to organize your project. As soon as you begin using non-trivial R packages, it will become increasingly difficult to manage dependencies (and the dependencies of those dependencies) through a point-and-click interface.

If this isn’t possible for whatever reason, you can download a single JAR file called:


from the Renjin website and manually add this as a dependency in Eclipse.

See the eclipse-dynamic-web-project example project for more details.

3.1.5. JBoss

There have been reports of difficulty loading Renjin within JBoss without a specific module.xml file:

<module xmlns="urn:jboss:module:1.1" name="org.renjin">
    <resource-root path="renjin-script-engine-3.5-beta76-jar-with-dependencies.jar"/>
    <module name="javax.api"/>

3.1.6. Spark

The spark-submit command line tool requires you to explicitly specify the dependencies of your Spark Job. In order to avoid specifying all of Renjin’s dependencies, as well as those of CRAN, and BioConductor packages, or your own internal packages, you can still use Maven (or Gradle or SBT) to automatically resolve your dependencies and build a single JAR that you can pass as an argument to spark-submit or dse spark-submit.




  <!--- Assembly plugin to build single jar -->

  <!-- Renjin and Spark/DataStax repositories -->

See the renjin-spark-executor project or the datastax/SparkBuildExamples repository from DataStax for complete examples.

You can then submit your job as follows:

mvn clean package
spark-submit --class org.renjin.ExampleJob target/renjin-example-0.1-dep.jar