Archive for the 'runtime' Category


creating an executable jar out of your Scala code

In the previous post about creating an executable jar from your Scala code, I showed how to create the jar using your favourite compression software.
Today, you’ll see how to do it using jarjar. jarjar can be used to package all of your jars into a single one, thus eliminating external dependencies.
The great part is that it has an ant task, so I’ll show you how to use that:

<project name="jarjar tester">
	<target name="jrjr">
		<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="jarjar-1.0.jar" /> 
		<jarjar destfile="jrjarilo.jar" manifest="">
			<zipfileset src="scala-library.jar" /> 
			<fileset dir=".">
				<include name="*.class" /> 

You need to supply it with a manifest, so, you could use the one from here. You need to adjust the paths to your scala-library.jar and to jarjar.jar, and to specify the name you’d like your jar to receive.

If everything goes well ( and it should ), after running this target you should have your own executable jar, containing the Scala runtime.

Blog Stats

  • 264,622 hits