I have this code that works perfectly when used in the scala REPL, but when I try to compile it using scalac, I get a bunch of errors.
This is my code (too long to post here) - http://pastebin.com/rkKL3xjH
And the errors I get are:
error: expected class or object definition
How do I compile my code so that it can be opened on another computer and executed? I am new to scala and programming so I don't know how to do this yet or what needs to be included in my file.
You can use the SBT plugin for assembly to do what you want.
Follow the instructions here: https://github.com/sbt/sbt-assembly.
By default the fat jar that it produces will have all of the class files that you need to run the jar on a computer that just has java installed.
Of course this is all predicated on the fact that you create a SBT project and use SBT as a build tool.
In order to use SBT as a build tool you can follow the instructions located here:
Edit:
In addition to using sbt you'll have to form up your application in a standard way that has a "main" function to execute.
object HelloWorld {
def main(args: Array[String]) {
//Execute code here
}
}
Though it would be hideous, you could probably just paste your entire program into the main and it might work.