New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSR 223 Scala ScriptContext does not support setWriter #8422
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8422?orig=1 |
Margaret Leber (MaggieL) said (edited on Mar 8, 2015 11:23:02 PM UTC):
|
Margaret Leber (MaggieL) said: in
gets
|
@SethTisue said: |
Margaret Leber (MaggieL) said: I spent a lot of time going though gyrations trying to get the classpath right in our sbt-based Play app so we could actually get a Scala This was a huge disappointment. Certainly |
@SethTisue said: the following workaround bypasses the official JSR 223 API but may be useful, regardless:
|
@SethTisue said: |
Margaret Leber (MaggieL) said: |
@som-snytt said: So a snippet that uses It's too bad the Otherwise, the solution is for the script engine to |
@som-snytt said: |
This code should print first the stars and after that the number three. However, it seems that setting the context does not have any effect.
{code} val w = new StringWriter()
val engine = new ScriptEngineManager().getEngineByName("scala")
val c = new SimpleScriptContext()
c.setWriter(w)
engine.setContext(c)
engine.eval("println(3)")
println("***")
println(w.toString()){code}
The text was updated successfully, but these errors were encountered: