scala代码可以在命令行中运行但是eclipse

时间:2014-10-15 01:52:38

标签: scala sbt

import com.twitter.finagle.{Http, Service}
import com.twitter.util.{Await, Future}
import java.net.InetSocketAddress
import org.jboss.netty.handler.codec.http._

object Client extends App {
//#builder
  val client: Service[HttpRequest, HttpResponse] =
    Http.newService("www.google.com:80")
//#builder
//#dispatch
  val request =  new DefaultHttpRequest(
    HttpVersion.HTTP_1_1, HttpMethod.GET, "/")
  val response: Future[HttpResponse] = client(request)
//#dispatch
//#callback
  response onSuccess { resp: HttpResponse =>
    println("GET success: " + resp)
  }
  Await.ready(response)
//#callback
}

我有这个代码 当我从命令行运行它时,它可以工作

./sbt 'run-main Proxy'

但是当我从scala ide(eclipse)运行它时 它给了我

Error: Could not find or load main class Server

为什么?我怎样才能解决这个问题? 感谢

0 个答案:

没有答案