Firstly, Clojure has no interpreter. All Clojure code is compiled into JVM bytecode when it is being loaded. I'm stressing this point, because this is were Clojure's excellent performance story begins.
Secondly, you don't really "install" Clojure in the sense that you do Ruby. Clojure comes as a jar
file, which is just a bunch of Java classes; if you put the jar
file on your classpath, you can run methods of those classes. Of those classes, clojure.main
provides a main
method for running REPLs and "scripts". So, running the REPL is indeed running a Java (that is, JVM) programme; and running a clj
file amounts to asking clojure.main
to load and run it (the actual work is handed off to other classes in Clojure's implementation, but clojure.main
is the entry point). BTW, this is exactly the same as with JRuby.
Every JVM programme is ultimately "merely a compiled Java file", or perhaps a bunch of such files. To run it, you need to have a JVM instance load it and run the appropriate main
method. Note that C programmes (such as ruby
-the-command) are only different in that the operating system knows how to find their main
functions for you (well, the equivalent of Java's classpath works pretty differently too, but the main concepts are the same). With JVM programmes, you need to use an OS-friendly executable (java
/ java.exe
) to kick things off.