I have the following Scala class, I am able to run it from command line by first typing sbt then in sbt mode. But I am not able to run it from eclipse . I am already in scala perspective.
> run-main bcomposes.twitter.QuerySearch #IPL
package bcomposes.twitter
import twitter4j._
import collection.JavaConversions._
/**
* Gets a Twitter instance set up and ready to use.
*/
trait TwitterInstance {
val twitter = new TwitterFactory().getInstance
}
/**
* Given a command line query, search for tweets and print
* them.
*/
object QuerySearch extends TwitterInstance {
def main(args: Array[String]) {
val statuses = twitter.search(new Query(args(0))).getTweets
statuses.foreach(status => println(status.getText + "\n"))
}
}
Make sure the package name you specified under which your scala object file is added matches the package name you mentioned in your code. So, correct this and then check, "Run as Scala Application" should be available now