I am trying to invoke scala interpreter programmatically using the following code
val settings = new Settings()
settings.usejavacp.value = true
settings.embeddedDefaults[Probe]
classPath.map(settings.classpath.prepend(_))
classPath.map(settings.bootclasspath.prepend(_))
settings.withErrorFn(err => println(s"error while compiling $err"))
val compile = new Global(settings)
val run = new compile.Run
val sourceFiles = run.compile("Test.scala")
Test.scala looks like
class Test {
println ("Hello World!")
}
build.sbt dependencies looks like
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % "2.11.7",
"org.scala-lang" % "scala-library" % "2.11.7",
"org.scala-lang" % "scala-reflect" % "2.11.7"
)
and getting following error
[error] (run-main-1e) scala.reflect.internal.FatalError: class StringContext does not have a member f
I have tried prepending scala-reflect-2.11.7.jar and scala-library-2.11.7.jar, but nothing seems to do work