How do I make an executable program?

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[1] 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[1]. 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.