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

Frequently Asked Questions - Deployment

For distribution to other Scala users, you can distribute your program via Scala Bazaars. For distribution to wider audiences, you can do it the same way as with any other Java program. Just be sure to include scala-library.jar along with the rest of your compiled code.


There are two general strategies: you can write a script file and use the interpreter, or you can compile an object that has a main method.

To make a script file, simply put Scala code into a file and make the file executable. See the scala(1) reference page for details and examples.

To use a main method, you must include in your Scala code an object with a main method. The main method should have the same type signature as in Java, namely:

  def main(args: Array[String]): Unit

Once you have such an object, you can already run it using the scala(1) program. To make your program more convenient, you can write a shell script file that invokes scala the correct way, thus making your program appear like any other program on the platform.


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