Learn R Programming

jsr223 (version 0.3.4)

getKotlinScriptEngineJars: Search for Required Kotlin JAR Files

Description

The getKotlinScriptEngineJars function searches a directory recursively for kotlin*.jar files required to create an instance of the Kotlin script engine. Because Kotlin does not provide a standalone script engine JAR file, we include this convenience function to simplify adding JAR files to the class path.

Usage

getKotlinScriptEngineJars(
  directory,
  minimum = TRUE
)

Arguments

directory

A character vector of length one specifying a path that contains Kotlin script engine JAR files.

minimum

A logical vector of length one. When TRUE (the default), the function returns only the minimum required JAR files to instantiate a script engine. If FALSE, all JAR files of the pattern kotlin*.jar will be returned.

Value

A character vector containing paths to the JAR files.

Details

The function searches the given directory recursively. If one or more of the required JAR files are not found, the function throws an error with a message listing the required files.

As of this writing, a standalone Kotlin compiler installation does not contain all of the required files to create a script engine instance. See section ``Script engine installation and instantiation'' in the User Manual for more information.

See Also

ScriptEngine

Examples

Run this code
# NOT RUN {
library("jsr223")
jars <- getKotlinScriptEngineJars("~/my-path/kotlin")
engine <- ScriptEngine$new("kotlin", jars)
engine %~% "1 + 1"
engine$terminate()
# }

Run the code above in your browser using DataLab