Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error running scala console. Module not found

I am able to run sample code, which I have saved in sample.sc and the results are displaying on Scala console. But I get an error when running the following program, which I saved as the Timeprogram.scala script:

/**
 * Created by sarathrnair on 3/18/15.
 */


println ( "Enter the seconds" )

val totalSeconds=readInt()
val displaySeconds=totalSeconds%60
val totalMinutes=totalSeconds/60
val displayMinutes=totalMinutes%60
val displayHours=totalMinutes/60
val sec=displaySeconds.toString
val min=displayMinutes.toString
val finalString=displayHours+":"+("0"*(2-min.length))+min+":"+("0"*(2-sec.length))+sec

println (finalString)

The error I get is:

Error running scala console. Module is not specified.

Please help me determine the reason behind this error.

like image 954
user3116355 Avatar asked Mar 27 '15 08:03

user3116355


1 Answers

The reason for the error mentioned when selecting "Run Scala Console", i.e. -

Error running scala console. Module is not specified.

is that there is no module specified in the Scala Console Run Configuration. Click on the run configuration dropdown and select "Edit Configurations..." There you can specify a module.

enter image description here

But this is just if you want to open a REPL shell within IntelliJ. If you just want to run the Scala program do it as in the accepted answer and just select "Run" instead of "Run Scala Console".

like image 194
Stephen Avatar answered Sep 28 '22 08:09

Stephen