How to make a scala standalone jar?

I have written a simple hello world app in scala.Now I want to export it into a standalone executable jar which can be run with Java .
How do I do that ?

Thank you !

Use coursier. It has a command-line “bootstrap” tool that can either make a
“download-upon-startup” executable, or a “standalone” executable. You just
need maven or ivy artifacts available in a public repo that define your

BTW, works for vanilla Java as well as Scala, though it was written
specifically for scala I believe.

Brian Maso

1 Like

There’s also sbt-assembly, which lets you export an uberjar straight from SBT.

One thing to note, however, is that Assembly will merge all jars into one, while some other tools like JarJar create a second-layer jar that contains the jars verbatim, together with some bootstrap code. I’m not sure, but I suspect Coursier takes the latter approach as well.

Assembly’s approach is simpler and doesn’t require any messing around with the classpath, but it can get confused if multiple jars contain the same file.