Friday, September 11, 2009

My First Scala Issue

Decided to try writing some Scala before going to a talk on it at my local JUG. That way I could put my hand up with the cool group when they ask "Who's actually written some Scala?".

scala-lang suggested that any of Eclipse, IDEA or NetBeans have mature plugins, so I downloaded IntelliJ IDEA 9.0M1, installed the plugin, pasted in someone else's Hello World example, hit CTRL-SHIFT-F10 and then sat back to watch in awe.

Unfortunately, there was no Scala joy. IDEA was kind enough to tell me that "Compilation completed with 1 error and 0 warnings" but wouldn't show me anything about what the error actually was. The line above was simple followed by a pretty little red 'X' icon, with no text next to it.

I Googled around a bit and found a few people - but not many - had had a similar problem. Maybe it was a Snow Leopard issue? Some JetBrains guys had suggested to someone else that the character encoding of their scala files mightn't be what Scala was expecting. So I spent half an hour trying to play around with the character encodings of my single file, my whole project and the compiler, but got nowhere.

In the end, I found a simple solution: I deleted IDEA 9.0M1, downloaded IDEA 8.1 and started again. Within 3 minutes the HelloWorld was compiled and running, with no sign of invisible errors. Hooray!

Lesson learned: Maybe it's better not to try and experiment with a fast-moving, non-core technology (e.g. Scala) in a pre-GA Java IDE release (IDEA 9.0M1).

1 comment:

  1. By the way, I'm happy to inform that the newer version of IntelliJ IDEA, including the Community Edition, can compile and run Scala programs perfectly on my Mac. Yay!