Pillsy
Pillsy

Reputation: 9901

Class not being built using Scala Eclipse plug-in

I'm trying to use the Scala Eclipse plug-in (version 1.1.0, which appears to be the most current) with version 3.7 of Eclipse on Mac OS X 10.6.8. I've copied the "Hello, World" program from a tutorial website. I was able to build the program successfully using the command-line scalac compiler. However, when I attempt to run the project as a Scala application from within Eclipse, I get an error like so:

Exception in thread "main" java.lang.NoClassDefFoundError: de/vogella/scala/first/Hello

with a bunch more stuff following. Looking in the relevant directory structure in my Eclipse workspace directory shows that the associated bin directory is completely empty. However, there are no errors (and indeed no messages of any sort) when I select "Build Project" from the menu.

As far as I can tell, my Eclipse installation is otherwise functional. I can, for instance, successfully build and run Java projects.

Any tips on where to start with troubleshooting would be greatly appreciated. Trying the suggested solutions in the most relevant-seeming existing question didn't work.

EDIT to add: There isn't anything in the Error Log window except this:

System property http.nonProxyHosts has been set to 
local|*.local|169.254/16|*.169.254/16 by an external source. This value will be 
overwritten using the values from the preferences

which doesn't strike me as terribly relevant. The full text, as copied from the tutorial, of the Hello.scala file, is

package de.vogella.scala.first

object Hello {
  def main (args: Array[String]) {
    println("Hello, world!")
  }
}

and the package the file is a part of is called de.vogella.scala.first.

Upvotes: 1

Views: 255

Answers (2)

Pillsy
Pillsy

Reputation: 9901

I followed Kipton Barros' suggestion from the comments, and installed the 2.0.0 beta of the Scala IDE plug-in for Eclipse. While I find it slightly strange that switching from a final release to a beta release resolved the issue, resolve the issue it did.

(Too bad I can't accept a comment as the answer.)

Upvotes: 2

freekh
freekh

Reputation: 176

Check if the package declaration in your scala file match the packages in eclipse.

Upvotes: 0

Related Questions