I just played with Scala and installed the Eclipse plugin as described at http://www.scala-lang.org/node/94 , but after entering the Hello World example and configuring the launch configuration as described, I get the following error :
Exception in thread "main" java.lang.NoSuchMethodError: main
For reference code
package hello object HelloWorld extends Application { println("Hello World!") }
I worked a bit with the obvious solutions (adding the main method, adding a singleton object with the main method), but I'm obviously doing something wrong.
Can someone get my test case to work or indicate what I'm doing wrong?
. : a) scala, ( ) .
, , - "arguments". , , ,
:
package hello class HelloWorld extends Application { Console.println("Hello World!") }
class object, object, Eclipse.
class
object
, , strg + s ( ). .
,
package hello object HelloWorld { def main(args:Array[String]) { println("Hello World!") } }
HelloWordSrc.scala( , "Src" ), , , Eclipse . " " Eclipse, , - ,
. :
.
, IMHO Eclipse HelloWorld.class . , , HelloWorld $.class( ). ...
. : , "properties- > Java Build Path", , " " - " / bin". " / ", . , - , ".class" "classes"
, - / Java. , familier Java.
Scala . , .
, . Scala Eclipse , , , , .
NetBeans. IDEA, .
Netbeans ~ , . Eclipse 3.4 + Scala Plugin 2.7.5 Final . Eclipse 3.4, Scala 2.7.5, .. Scala? .. → Scala? , , .
If you are using the latest version of scala (2.9. *), You should use
object HelloWorld extends App { println("Hello World!") }
An application, not an application. The application was in 2.8 or 2.7 way. This is the only problem - this is another question.
The simple answer is: if you are using (NetBeans OR Eclips) just restart the program yet Move the class to another class, which may help