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.
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…
Raju, the latest version of the plugin (2.6.2) has fixed this.
hi..binil…
yur case was an absolutely correct..
iam also from kochi…
can i know about tavant and job openings
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”)
}