How does one run a Scala Application?

I've got the following code:
object HelloWorld extends Application {
println("Hello, world!")
}

It shows up as a Scala class, but there's no option to run it when I right click on it. I also don't see any option in my run menu to run as either Scala or as an Application by specifying a main class. So how is everybody running their Scala stuff in IntelliJ? Command line?

10 comments
Comment actions Permalink

In our plugin you can run only application with main object such:

object ObjectName {
..def main(args: Array\[String\]) {
....//Some code
..}
}

There is no option to run class, which extends Applicationt. It will be not so far. For the time present you may use command line.
Sorry for inconvenience.

1
Comment actions Permalink

Any estimates when will right click -> run Application be supported? This sounds like a minor feature to implement, with a good roi to the users of the plugin. For example running specs or scalacheck would be much easier with this feature supported.

0
Comment actions Permalink

It is supported for objects that contain def main(Array[String]) method. What we do not yet support is the search for main method in base classes/traits (e.g. scala.Application - that will be deprecated anyway, see http://scala-blogs.org/2008/07/application-trait-considered-harmful.html)

0
Comment actions Permalink

I'm aware about the blog post and about the discussion about deprecating the Application trait. However, right now it is still part of standard scala and a perfect way to run individual test of any framework that uses the Application trait.

Is there plans to add the support for running objects that have the trait Application or main method in inherited classes? An if there is, is there some schedule for this feature?

0
Comment actions Permalink

Well, I cannot reply on the schedule, but the efforts required to make this happen are substantial: there will be a mapping from scala types to java types needed, as well as some bits of java psi implemented for scala classes and methods. But do you really care about that feature so much? Or should it really be prioritized after full type system implementation, signaling compiler errors at edit time and some refactorings?

0
Comment actions Permalink

>> full type system implementation, signaling compiler errors at edit time and some refactorings?


Yes please!!! :o)

0
Comment actions Permalink

Yes, the feature is really that important.

0
Comment actions Permalink

I'll add my 2c worth to this issue, I don't believe that this is a big issue at all, it's an optimisation that's a nice to have, and even then I don't think it's very important.

0
Comment actions Permalink

Please suggest how to run this project : https://github.com/ibm-cds-labs/spark.samples.git 

 

It does not contain pom.xml to import as maven or else;

installed scala, sbt and related , but still nt able to run this

0
Comment actions Permalink

@niti Just import project into IntelliJ IDEA as SBT project (it contains build.sbt file).

0

Please sign in to leave a comment.