Home > tech > Scala Eclipse Plugin: Snag Getting Started

Scala Eclipse Plugin: Snag Getting Started

Tonight I tried taking Scala for a spin.

I installed the Scala Eclipse plugin, created a hello project, switched to Scala perspective in the IDE, created a test package, and created an object HelloWorld in it, with the code to print the customary message. When I tried to run this code by right-clicking the file by choosing Run As -> Scala Application, the code throws up the error:

    java.lang.NoClassDefFoundError: src/test/HelloWorld
    Exception in thread "main"

I searched the web for some help, but eventually got to a bug reported by an outside contributor. The bug is marked as “not reproducible” but yet I was reproducing exactly the described behavior 😦

After a bit of digging around, I figured out what is wrong – when one right clicks as chooses Run as -> Scala application, the run configuration created is incorrect. The Scala Application Object is set to be src.test.HelloWorld; changing it to test.HelloWorld makes the code run fine. Posting this here to help others trying the plugin.

Advertisements
Categories: tech
  1. Raju
    June 19, 2007 at 2:05 am

    Thank you! I have to admit, my first pass at the Scala plugin was less than pleasant… Little did I know it was such a simple fix…

    Thank you again…

  2. June 19, 2007 at 1:13 pm

    Raju, the latest version of the plugin (2.6.2) has fixed this.

  3. jose
    April 15, 2008 at 11:54 am

    hi..binil…
    yur case was an absolutely correct..
    iam also from kochi…
    can i know about tavant and job openings

  4. Mike Warren
    July 19, 2009 at 8:42 pm

    I got the same error on 2.7.5 version of plugin – but found using “new Scala Application” option worked –
    Think the Application class can’t be found in the example given – but the code below works for me

    package hello

    object HelloWorld2 {
    def main(args : Array[String]) : Unit = {}

    Console.println(“Hello”)
    }

  1. May 29, 2007 at 2:44 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: