Debugging methods in Scala library from Eclipse

How do I display variables in Scala methods while calling them from Java program in Eclipse debugger? I am debugging a Java program which calls methods in Scala libraries. I can put breakpoints there and the break-point works. But the debugger is unable to display the variables. I am using Eclipse.


Well, it's gonna be quite non-trivial if you don't install the Scala plugin for Eclipse, you can find it here:

Scala is compiled for the JVM so you will be able to debug it without the plugin. Theoretically. The practical issue is that the class file contains tons of generated stuff which can be extremely hard to understand (even for guys who're pro how Scala translates its concepts, e.g., anonymous functions into bytecode).

Just an example: you'll have to deal with monsters like scala.some.Class$$anon$1$$anonfun$someFunction$1$2$$anonfun$apply$2.apply. It is far-far easier if you install the plugin and see something like c -> c.somefunction( println(e)).

So try to find out which version of Scala was used for your dependency, install the required Scala IDE for that Scala version, attach the source and you'll be able to debug.

Make sure you use the scala-ide

See here the support for debugging Scala projects and how to set it up:

Need Your Help

Why is turning magic_quotes_gpc on considered a bad practice?

php magic-quotes-gpc

Why is turning magic_quotes_gpc on in PHP is considered a bad practice?