Scala development in NetBeans

Functional languages are cool in terms of making application parts running in parallel. This brings you great scalability of an application when running on multicore systems or in the 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 the 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 the problem.

Scala development in NetBeans

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

Compilation failed with an 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:

scala 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. 

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

Thank you for the nice message. Let’s follow it. Wow, finally it runs fine.

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 favorite 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. 

Want to stay updated on the latest tech news?

Sign up for our monthly blog newsletter in the form below.

Softteco Logo Footer