Generating class in Zeppelin

If you want to declare a class in Zeppelin and create instance of it, you might be surprised:

What happened? Whatever you declare in Zeppelin notebook is a part of some internal class so the newly declared class K doesn’t have parameterless constructor because it expects the instance of enclosing type. There are two simple ways to handle this.


Just generate a class with scala’s quaisquotes:

Use the following method to dynamically compile java code:

Invoke it like this:

And you are done.