Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a scala program in terminal?

I have created a .scala file in the Scala version of eclipse, it has a main and object. I want to somehow compile this possibly into a jar file, so I can run it from terminal?

any info will be appreciated.

Thanks, Rhys

like image 362
Programmerr Avatar asked Dec 19 '16 18:12

Programmerr


1 Answers

Here is the full process from the command line:

evan@vbox ~> cat test.scala
object test{
    def main(args: Array[String]): Unit = println("Hello!")
}
evan@vbox ~> scalac test.scala
evan@vbox ~> scala test
Hello!

However if you want to use Scala IDE to its full potential I would check out this tutorial.

like image 196
evan.oman Avatar answered Oct 12 '22 06:10

evan.oman