java -cp clojure-1.11.1.jar:spec.alpha-0.3.218.jar:core.specs.alpha-0.2.62.jar clojure.main
Clojure 1.11.1
user=> (println "Hello REPL!")
Hello REPL!
This is gonna be a rather short and trivial post but I wanted to share it anyway because it can be useful, ocassionally.
Recently, I needed to test a piece of Clojure code without having to access to clojure installation. There were two such places:
Inside a Docker container
Windows VM
For the Windows VM, I couldn’t install Clojure at all - the official instructions didn’t work.
Fortunately, I remembered the "Clojure is just a JAR" meme [1].
I began, by downloading Clojure JARs for the current release.
Notice that you need to download a couple of other JARs, not just the clojure artifact. That’s because in Clojure 1.9, Spec was moved into a separate library to make it easier to evolve it independently from Clojure.
Once you have all the artifacts in place, getting the REPL is easy:
java -cp clojure-1.11.1.jar:spec.alpha-0.3.218.jar:core.specs.alpha-0.2.62.jar clojure.main
Clojure 1.11.1
user=> (println "Hello REPL!")
Hello REPL!
That’s all you need for a very basic exploration of the code.
(Clojure) 1.9/spec split
The REPL and main entry points (about clojure.main
namespace)