Scala development in NetBeans

Functional languages are cool in terms of making application parts running in parallel. This brings you great scalability of appllication when running on multicore systems or in cloud. So I’ve started looking at the direction of Scala which is based on Java and adds all benefits of the functional programming.

I plan to see how Java integrates with Scala and vice versa in the next post. This one just describes problems of a newbie when trying to run first Scala project in NetBeans.

So I’ve used the latest NetBeans 6.8 with the installed Scala module and Scala 2.7.7.

So started NetBeans, created Scala project and began starring at the file trying to understand the source of problem

Why the hell I see errors immediately after creation of the project? But the files are really correct. I’ve verified this according to manual. So decided to compile and see how it works.

Compilation failed with the following error:

You must set SCALA_HOME or environment property and append 

“-J-Dscala.home=scalahomepath” property to the end of “netbeans_default_options” in NetBeansInstallationPath/etc/netbeans.conf to point to Scala installation directory.

Started searching for UI to specify path to the Scala installation – haven’t found any. Okay, specified SCALA_HOME and restarted NetBeans. Tried to compile again:

/home/andrey/Temp/ScalaApplication1/nbproject/build-impl.xml:236: scalac doesn’t support the “fork” attribute

Nice, passed to build-impl.xml and removed fork attribute. Compiled again:

/home/andrey/Temp/ScalaApplication1/nbproject/build-impl.xml:236: Parameter ‘-make:transitive’ is not recognised by Scalac.

Well, removed parameter from build-impl.xml. This time I was able to compile and run application.

Okay, let’s now try to create java application which calls Scala code.

But this code compiles nicely. Okay, lets try to run it and we get:

Exception in thread “main” java.lang.RuntimeException: Uncompilable source code
        at javaapplication1.Main.main(
Switch off “Compile on Save”

Thank you for a nice message. Lets follow it. Wow, finally it runs fine.

Trying to debug:

Okay, but I can see it and application runs.

So what can I say – currently developing Scala in NetBeans is not very smooth. NetBeans is my favourite IDE but now I’m a bit disappointed with the Scala integration which was considered to be “Full Featured”:

Full featured Scala editor providing syntax and semantic coloring, source file navigator, code folding, mark occurrences, go to declaration, instant rename, indentation, formating, pair matching, error annotations, code completion, and in addition: project management (build/run/debug project), debugger, interactive console, JUnit integration, Maven integration.

Plan to try out Scala integration in Eclipse and IDEA. Hope it would be smoother. I’m still a newbie to spend much time on configuring my IDE to work with Scala. 🙂