Small and furry, well ... definitely furry. [source]

Friday, June 17, 2011

Create "executable" Clojure programs

Sometimes you want to distribute one executable. You can create a standalone uberjar (using lein uberjar), however the user still need to call java -jar . One wait is to use one of the Java installers out there.

Another simple way is to embed the jar in a script (we'll use base64 here). And then have the script extract the jar and run Java on it. (Note that I'm using the base64 utility that comes with Linux, you can probably use MIME::Base64 as well).


EDIT: Seems like there is a simpler solution.

1 comment:

  1. Or if you are using cake you can just run:

    $ cake bin

    And it will generate a similarly encoded, executable jar file.

    ReplyDelete