Load Scala file into interpreter to use functions?

user550617 picture user550617 · Sep 12, 2011 · Viewed 28.2k times · Source

I have some Scala functions defined in a file, not in a class, and I would like to use them in the Scala interpreter. I know I can say scala filename.scala to simply run the file and exit the interpreter, but I would like to run the file and then stay in the interpreter so I can do some testing. Can anyone tell me how to simply load a file into the interpreter so I can use the functions defined within it?

Answer

Jamil picture Jamil · Sep 12, 2011

type :load /path/to/file in Scala REPL.

You can get complete list of available commands by typing :help