Running a Scala App in IDEA 9

My first experience with IDEA hasn’t been a good one. In all fairness, not IDEA itself, but with a plugin (isn’t that always the way). I use Eclipse on a day to day basis, but since I heard that the IDEA Scala support is much better, I decided to download the Community Edition and give it a bash.

After following these instructions to hook up a Maven Scala project in IDEA (why not just go all in) I went to run the auto generated app:

package net.jakubkorab

/**
 * Hello world!
 */
object App extends Application {
	println("Hello World!")
}

The instructions were straightforward “just do CTRL SHIFT F10 and it’ll run”. Tried that. Nothing. Huh? To the net…

“Add a new Run configuration – Scala Application”. Nothing.
Maybe it’s a plugin version thing? Google… *muttering*

“you’ll need a different plugin called Scala Application”. Search for the plugin… Doesn’t exist. *more muttering*

Finally I found this post from 2008 – seems the plugin won’t run classes that extend scala.Application – you have to give it a main() method!

NP. Given that not many people have actually met sailors, I’d like to propose “swears like a programmer”.

package net.jakubkorab

/**
 * Hello world!
 */
object App {
	def main(args:Array[String]) {
		println("Hello World!")
	}
}

CTRL SHIFT F10 and it works. If you look in Run configurations, it’s been set up as an Application, not a Scala Application like some of the other sites suggest.

Not a good start with IDEA, but like most systems with plugins, don’t throw the baby out with the bath water. I look forward to happier times from here on.


Posted

in

by

Tags:

Comments

2 responses to “Running a Scala App in IDEA 9”

  1. bob Avatar
    bob

    the scala toolchains are very poor. you’re entering a maze of twisty passages, all different

  2. denny Avatar
    denny

    Thanks! I’m a scala newbe and HelloWorld finally worked in IDEA after your post!