Curious (Clojure) Programmer Simplicity matters

Menu

  • Home
  • Archives
  • Tags
  • About
  • My Talks
  • Clojure Tip of the Day Screencast
  • (Open) Source
  • Weekly Bits & Pieces
  • RSS
September 15, 2023

Starting Clojure REPL with plain java

Table of Contents
  • Download
  • Run
  • References

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:

  1. Inside a Docker container

  2. 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].

Download

I began, by downloading Clojure JARs for the current release.

  • https://repo1.maven.org/maven2/org/clojure/clojure/1.11.1/clojure-1.11.1.jar

  • https://repo1.maven.org/maven2/org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar

  • https://repo1.maven.org/maven2/org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar

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.

Run

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.

References

  • Install Clojure

  • Clojure Downloads

  • (Clojure) 1.9/spec split

  • The REPL and main entry points (about clojure.main namespace)


1. Nowawdays, a more accurate description would be "Clojure is just a collection of JARs"

Tags: clojure java REPL

« Evernote productivity shortcut: quick & easy way to open the URL/link under the cursor Git - How to Delete Merged Branches Older than X Days? »

Copyright © 2025 Juraj Martinka

Powered by Cryogen | Free Website Template by Download Website Templates