# Kotlin JSR223 Scripting

**URL:** https://discuss.kotlinlang.org/t/kotlin-jsr223-scripting/26053
**Category:** Uncategorized
**Created:** [December 8, 2022, 11:24am UTC](https://discuss.kotlinlang.org/t/kotlin-jsr223-scripting/26053 "2022-12-08T11:24:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sterg](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sterg](https://discuss.kotlinlang.org/u/sterg)
#### Post date: [December 8, 2022, 11:24am UTC](https://discuss.kotlinlang.org/t/kotlin-jsr223-scripting/26053/1 "2022-12-08T11:24:58Z")

</div>

With the recent 1.8.0 release of Kotlin,  
I create a Kotlin JSR223 Scripting Engine from a Java application with:

kotlinEngine = new ScriptEngineManager().getEngineByExtension(“main.kts”);

The engine is created, i.e. it is not null.

However, when I try to evaluate statements I get the following error:

ERROR Unable to initialize repl compiler:  
DEBUG Using JVM IR backend  
WARNING Using new faster version of JAR FS: it should make your build faster, but the new implementation is experimental  
ERROR @NotNull method org/jetbrains/kotlin/config/CompilerConfiguration.getNotNull must not return null:

What happens?

---

<div class="post-metadata">

### Author: ![abeshenov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abeshenov/32/10091_2.png) [@abeshenov](https://discuss.kotlinlang.org/u/abeshenov)
#### Post date: [December 16, 2022, 11:47pm UTC](https://discuss.kotlinlang.org/t/kotlin-jsr223-scripting/26053/2 "2022-12-16T23:47:11Z")

</div>

What works for me is

```auto
import javax.script.ScriptEngine;
import javax.script.ScriptException;
import kotlin.script.experimental.jsr223.KotlinJsr223DefaultScriptEngineFactory;

...

ScriptEngine kotlinEngine = new KotlinJsr223DefaultScriptEngineFactory().getScriptEngine();

```

The dependencies are `org.jetbrains.kotlin:kotlin-scripting-jsr223` and `org.jetbrains.kotlin:kotlin-compiler-embeddable`.

~~Is it specific to 1.8.0? I’m at 1.7.22.~~ I tried it with `1.8.0-RC` and it still works.

Do you have a minimal example reproducing the issue?

---

<div class="post-metadata">

### Author: ![wisdomtl](https://avatars.discourse-cdn.com/v4/letter/w/278dde/32.png) [@wisdomtl](https://discuss.kotlinlang.org/u/wisdomtl)
#### Post date: [September 23, 2023, 4:03pm UTC](https://discuss.kotlinlang.org/t/kotlin-jsr223-scripting/26053/3 "2023-09-23T16:03:49Z")

</div>

Is the code above worked for Android project?
