Reputation: 9198
I have a very simple Scala file which I need to send to someone to execute on a machine without Scala (only Java). It's just one file, with one dependency on a jar (other than scala itself).
I'm struggling to package it properly. I'm not using sbt or anything. What's the simplest way to package it up?
Upvotes: 3
Views: 3211
Reputation: 3573
Assuming you have a file Test.scala
object Test {
def main(args: Array[String]){
println("Hello world!")
}
}
compile it with scalac
scalac Test.scala
Create file Manifest.txt with the following content:
Manifest-Version: 1.0
Created-By: 1.6.0_31 (Sun Microsystems Inc.)
Main-Class: Test
Copy scala library from your distribution into the current folder and unzip it:
unzip scala-library.jar
execute the command:
jar cvfm Hello.jar Manifest.txt *.class library.properties scala/
Send it to your addressee. He/she will have to execute
java -cp Hello.jar
Upvotes: 2