title: "eval" in Scala
body: <p>Can Scala be used to script a Java application?</p>
  
  <p>I need to load a piece of Scala code from Java, set up an execution scope for it (data exposed by the host application), evaluate it and retrieve a result object from it. </p>
  
  <p>The Scala documentation shows how easy it is to call compiled Scala code from Java (because it gets turned into to regular JVM bytecode).</p>
  
  <p>But how can I evaluate a Scala expression on the fly (from Java or if that is easier, from within Scala) ? </p>
  
  <p>For many other languages, there is the javax.scripting interface. Scala does not seem to support it, and I could not find anything in the Java/Scala interoperability docs that does not rely on ahead-of-time compilation.</p>