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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -