Jarmo Hurri <jarmo.hu...@iki.fi> writes: > When I look at the temporary file I see that the code has been > embedded in a wrapper defined in ob-scala.el. I guess it's the wrapper > that messes up the execution of the code.
> What is the wrapper for? How am I supposed to use it? Ok, got it by taking a closer look at ob-scala.el. In Babel scala code isn't compiled and executed, it is run in interactive mode (shell). The following works as expected (just as an example; you can also do this without the Fibonacci class). #+BEGIN_SRC scala :exports both :results output object Fibonacci { def fib (n : Int) : Int = { if (n == 1 || n == 2) n - 1 else fib (n - 1) + fib (n - 2) } } println (Fibonacci.fib (7)) #+END_SRC #+RESULTS: : 8 Jarmo