6

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

2 Answers 2

12

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Naturally you will need to make sure that both scala and scalac are in your path. How to do this depends on how you installed scala
2

To create the JAR, follow this:

Create a JAR from Eclipse

Then you can run it with

java -cp /path/to/My.jar com.co.package.MyObj

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.