How do I embed the Scala 2.8 interpreter in a Java application?

前端 未结 2 1749
忘掉有多难
忘掉有多难 2021-01-01 18:50

I want to be be able to manipulate objects in memory in my Java app interactively for debugging purposes. I would quite like to do this using Scala\'s 2.8 interpreter, taki

相关标签:
2条回答
  • 2021-01-01 19:26

    Here's an example of providing an embedded scala 2.9.1 over ssh: scala-ssh-shell

    0 讨论(0)
  • 2021-01-01 19:36

    See Josh Suereth's Embedding the Scala Interpreter.

    You can see the auto-complete suggestions below.

    josh@suereth-desktop:~/projects/blog/embed-the-interpreter$ java -jar target/embedded-interpreter-0.1-SNAPSHOT-jar-with-dependencies.jar 
    Welcome to Awesomeness!
    This is my version of the Scala interpreter
    TestInterpreter> j
    
    java javax jline
    

    I think he also implemented the feature into Scala IDE for Eclipse so you also take a look at that. The latest is available online.

    I wanted to run Scala code as part of testing, so I've implemented CompilerMatcher following his article.

    0 讨论(0)
提交回复
热议问题