Search code examples
scalaeclipse-pluginscala-2.8

Scala errors in Eclipse 3.5 using Scala 2.8.0b, "Syntax error on token String"


I seem to be missing libraries but I am not certain.

In this file:

object Test {
    def main(args: Array[String]) {
        for (arg <- args)
            println(arg)
    }
}

I am not certain what leads to these errors:

Description Resource    Path    Location    Type
Syntax error on token "object", interface expected  TestSrc.scala   /ScalaDataMiningFunctions/src   line 1  Java Problem
Syntax error on token "String", delete this token   TestSrc.scala   /ScalaDataMiningFunctions/src   line 2  Java Problem
Syntax error on token ":", delete this token    TestSrc.scala   /ScalaDataMiningFunctions/src   line 2  Java Problem
Syntax error on token "<", ( expected   TestSrc.scala   /ScalaDataMiningFunctions/src   line 3  Java Problem

I may just need to go through the steps and do this in Netbeans instead, but I would prefer to find out what is going on.

In my lift project, which was created by using maven, I don't have these errors, but there are many jar files there that I don't have in mine.

One jar file is scala-compiler-2.7.3.jar that is in the lift project but not in my scala project.

The only libraries in my scala project are Scala Library version 2.8.0r19106-... and JRE System Library [jre1.6.0_07]


Solution

  • Eclipse is seeing your Scala sources as Java and choking on them (the clue is the text "Java Problem" at the end of each problem report).

    Most likely you don't have JDT Weaving enabled (or not enabled successfully), so please follow the troubleshooting instructions here,

    http://scala-ide.assembla.com/wiki/show/scala-ide/Troubleshooting

    and if you still have issues, please follow up on the scala-ide-user list,

    http://groups.google.com/group/scala-ide-user