This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
8 Replies Last post: Sep 10, 2008 6:27 AM by Tom Adams  
Adam Krieg Newbie 88 posts since
Oct 11, 2002
Currently Being Moderated

Jun 7, 2008 7:30 PM

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?

Alexander Podkhalyuzin JetBrains 312 posts since
Jun 7, 2008
Currently Being Moderated
Jun 8, 2008 2:07 PM in response to: Adam Krieg
Re: How does one run a Scala Application?

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.

Tuomas Huhtanen Newbie 58 posts since
Aug 27, 2002
Currently Being Moderated
Aug 18, 2008 10:13 AM in response to: Alexander Podkhalyuzin
Re: How does one run a Scala Application?

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.

Eugene Vigdorchik Master 3,735 posts since
Feb 26, 2003
Currently Being Moderated
Aug 18, 2008 11:48 AM in response to: Tuomas Huhtanen
Re: How does one run a Scala Application?

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)

Tuomas Huhtanen Newbie 58 posts since
Aug 27, 2002
Currently Being Moderated
Aug 19, 2008 11:04 AM in response to: Eugene Vigdorchik
Re: How does one run a Scala Application?

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?

Eugene Vigdorchik Master 3,735 posts since
Feb 26, 2003
Currently Being Moderated
Aug 19, 2008 11:12 AM in response to: Tuomas Huhtanen
Re: How does one run a Scala Application?

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?

Nick D'Arcy Newbie 96 posts since
Dec 22, 2006
Currently Being Moderated
Aug 19, 2008 12:02 PM in response to: Eugene Vigdorchik
Re: How does one run a Scala Application?

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

 

 

Yes please!!! :o)

Tuomas Huhtanen Newbie 58 posts since
Aug 27, 2002
Currently Being Moderated
Aug 19, 2008 1:45 PM in response to: Eugene Vigdorchik
Re: How does one run a Scala Application?

Yes, the feature is really that important.

Tom Adams Newbie 11 posts since
Mar 24, 2005
Currently Being Moderated
Sep 10, 2008 6:27 AM in response to: Eugene Vigdorchik
Re: How does one run a Scala Application?

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.

More Like This

  • Retrieving data ...