Unable to run introductory scala code with package greeter

I am starting out to learn scala by following this MOCC on Coursera. I was following the instruction to write my first hello world program.

You should see a the hello world output in the Eclipse console.

1 Source code

package greeter
object Hello extends App {
  println("Hello, World!")
}

Right-click on the package greeter in the hello world project that you
just created Select “New” – “Scala Worksheet” Choose a name for your
worksheet (different than Hello or the name you chose for the “Scala
Object” before)

But I am unable to to compile the below as instructed.

   package greeter
    object Hello extends App {
      println("Hello, World!")
    }

instead if i remove package greeter line, I can run application as scala with no problem.

But the second issue came when I tried to follow along to create the Scala worksheet. I would be using the (default package) as shown on the left side bar. Right-clicking does not provide an option to create scala worksheet.
enter image description here

In addition, I wonder if the change from previous version of Scala to Scala 2.11 has been significant. Because I have spent 6 hours just trying to follow MOCC and online videos to set up my workspace in terminal and eclipse but quite a few of the screenshots are different to what I see in my IDE/ terminal.


Source: eclipse

Leave a Reply