Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an API for running Scala REPL programmatically? [closed]

Based on a thread and the Scala interpreter sources it looks like it would not be that hard to get the equivalent of

def runLine(line: String): String

but has someone written this already?

like image 788
Owen Avatar asked Sep 02 '11 18:09

Owen


1 Answers

There are many examples floating out there, but they may be hard to find. Here is the one I wrote a while back:

http://code.google.com/p/simplex3d/source/browse/trunk/Simplex3dConsole/src/simplex3d/console/SimpleInterpreter.scala?r=790

The tricky part is to get the interpreter to load Scala jars. I have loaded jars manually to make it work with web-start, but in your case, simple settings.usejavacp.value = true may suffice.

You can see the interpreter in action here: http://www.simplex3d.org/console/

like image 123
Lex Avatar answered Sep 28 '22 14:09

Lex