首先,我想说我已经阅读了有关同一问题的其他两个问题,并且其中列出的解决方案对我没有帮助。我试过清洁,重建,重新开放,但它已经解决了。我使用eclipse for scala dev。这是我试图获得输出的样本编程,它只是casbah。
package com.examples.casbah
import com.novus.casbah.mongodb.MongoConnection
object newObject {
def main(args: Array[String]): Unit = {
val mongoConn = MongoConnection()
val mongoDB = mongoConn("casbah_test")
val builder = MongoDBObject.newBuilder
builder += "foo" -> "bar"
builder += "x" -> "y"
builder += ("pie" -> 3.14)
builder += ("spam" -> "eggs", "mmm" -> "bacon")
// You must explicitly cast the result to a DBObject
// to receive it as such; you can also request it 'asDBObject'
val newObj = builder.result.asDBObject
Console.println(("A", "ProGGram"))
}
}
我在eclipse错误日志中收到以下错误:
抛出了意外的异常
我读了一条关于尝试通过点击源项目的根目录运行的评论。但我只看到Run as Java Applet和Run as Java Application。没有选项可以作为Scala应用程序运行。我必须使用Alt + Shift + X S
运行它TIA。