getKotlinScriptEngineJars: Search for Required Kotlin JAR Files

Description Usage Arguments Details Value See Also Examples

View source: R/Public.R

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

1
2
3
4
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.

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.

Value

A character vector containing paths to the JAR files.

See Also

ScriptEngine

Examples

1
2
3
4
5
6
7
8
## Not run: 
library("jsr223")
jars <- getKotlinScriptEngineJars("~/my-path/kotlin")
engine <- ScriptEngine$new("kotlin", jars)
engine %~% "1 + 1"
engine$terminate()

## End(Not run)

jsr223 documentation built on July 1, 2020, 10:30 p.m.