Error running scala console. Module not found

user3116355 picture user3116355 · Mar 27, 2015 · Viewed 16.3k times · Source

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.

Answer

Stephen picture Stephen · Aug 31, 2015

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".