I'm using IntelliJ IDEA Scala Worksheet. (Scala 2.11.2)
I'm trying to get ScriptEngine for Scala.
val e = (new ScriptEngineManager()).getEngineByName("scala")
But I get null
:
e: javax.script.ScriptEngine = null
How can I get Scala ScriptEngine in Scala Worksheet?
Possibly there is a bug in IDEA Scala plugin. In order to make it work, first of all, you need to add scala-compiler library to Dependencies, since the SPI is in scala-compiler.jar. Secondly, uncheck "Run worksheet in the compiler process" in IDEA Preferences. I guess scala-compiler.jar is not in the classpath when external compiler is started.