This page is no longer maintained — Please continue to the home page at

Cannot run a Scala source as a script

No replies
E. Labun
Joined: 2010-06-20,
User offline. Last seen 42 years 45 weeks ago.

Hi All,

this file can be started with the Scala script runner ´scala test.scala´, but it doesn't print anything:

---------- test. scala -----------
object A
object Y {
def main(args: Array[String]) {

If I comment out the ´object A´ line, then all is OK, the string "running" is printed.

Why is it so? Is it possible to make the script working with additional definitions
(classes/objects/traits) in the file?


see also:

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland