Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Clojure require a JDK?

Tags:

clojure

I want to distribute a Clojure program. Do I need a JDK or can a JRE handle everything in Clojure?

like image 912
yazz.com Avatar asked Jan 26 '11 17:01

yazz.com


2 Answers

You only need the user to have a JRE (v1.5 or above)

Clojure programs can be compiled into a jar file. You don't have to use something like leiningen, but it's a lot easier.

Check out this page on the Clojure.org site for how to compile and run a program.

You can compile to a jar file from the REPL:

(compile 'clojure.examples.hello)

Here's how you would run a compile jar:

java -cp ./classes:clojure.jar clojure.examples.instance asdf
like image 197
justinhj Avatar answered Sep 20 '22 12:09

justinhj


You just need a JRE.

https://github.com/technomancy/leiningen/blob/master/TUTORIAL.md explains in more detail, but I believe you just want an "Uberjar" which will contain all the dependencies that you need to distribute your application.

like image 33
Jeff Foster Avatar answered Sep 17 '22 12:09

Jeff Foster