Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Clojure?

I am new to clojure and I have tried to compile it last night but I couldn't seem to do it and I have no idea. I am on windows and don't know much about java. I just want a stand-alone file that I can give to my friends. (I know they need java) Can anyone help?

like image 778
GummyBEARZ Avatar asked Feb 11 '10 16:02

GummyBEARZ


3 Answers

The easiest way would be to use Leiningen. You can make a very simple project.clj file for your project with :main pointing to your main file's namespace, and then you could do 'lein uberjar' on the command-line and it would stick all your dependencies in a single executable jar file.

I'll point out that every file that needs to be compiled must have a namespace with :gen-class enabled. For example:

(ns whatever.main
  (:gen-class))
like image 94
Rayne Avatar answered Sep 21 '22 01:09

Rayne


How about an all in one Clojure installer for Windows? Unless I misunderstood your question and you want your Clojure files themselves compiled.

If you want to compile your own Clojure files, you can read this explanation on the Clojure site.

like image 27
Maurits Rijk Avatar answered Sep 20 '22 01:09

Maurits Rijk


for producing a stand alone clojure program Leiningen's uberjar option does just that! Install leiningen and then run:

lein uberjar

and you get a single file that your friends can use to run your program.

like image 39
Arthur Ulfeldt Avatar answered Sep 20 '22 01:09

Arthur Ulfeldt