Eclipse scala "Could not find or load main class" -
i have started learning scala, using eclipse ide it, in run configuration have set scala application project name , main class main when compile have
error: not find or load main class main
when check console see it's reading java/jre directory, normal or should change ? code
package 1 class main { object bottles { def main(args: array[string]){ var n : int=2; while(n<=6){ println(s"hello ${n} bottles"); n+=1; } } } }
the main
method needs on toplevel object. bottles
object wrapped in main
class. remove main
class , code should run.
object bottles { def main(args: array[string]){ var n : int=2; while(n<=6){ println(s"hello ${n} bottles"); n+=1; } } }
Comments
Post a Comment