Browse Learn Clojure Foundations as a Java Developer

Verify Your Clojure Installation

Check Java, the Clojure CLI, REPL startup, language version, classpath construction, and optional Leiningen commands before debugging project-specific setup problems.

When setup goes wrong, Java developers often lose time debugging the wrong layer. Verify the stack from the bottom up:

  1. Java
  2. Clojure CLI
  3. REPL
  4. classpath
  5. optional Leiningen workflow

This sequence tells you whether the failure is Java discovery, Clojure tooling, dependency resolution, editor integration, or project code.

Step 1: Verify Java

1java -version
2javac -version

If Java fails, stop. Clojure runs on the JVM, so Clojure tooling will not be reliable until Java is stable.

Step 2: Verify The CLI

1clojure --version
2clj -h

clojure --version reports the CLI tooling version. That is not necessarily the same as the Clojure language version used by a project dependency.

Step 3: Start A REPL

1clj

At the prompt, run:

1(clojure-version)
2(System/getProperty "java.version")
3(System/getProperty "java.home")

This verifies both the Clojure language inside the REPL and the JVM hosting it.

Step 4: Verify Classpath Construction

From the shell:

1clojure -Spath

This prints the classpath the CLI computed. It should include the project paths and dependency jars implied by your deps.edn files.

If this fails Likely layer
java not found Java install or PATH
clojure not found CLI install or PATH
REPL starts on wrong Java editor/shell Java selection
-Spath fails resolving deps dependency coordinates, proxy, certificates, or repository access
code namespace cannot load namespace-to-file mapping or classpath paths

Step 5: Verify Leiningen Only If Needed

If the project uses project.clj, also run:

1lein --version
2lein repl
3lein test

If the project uses only deps.edn, do not add Leiningen just to make setup feel familiar. Verify the workflow the project actually uses.

A Good Final Smoke Test

In a plain REPL:

1(+ 1 2 3)
2;; => 6
3
4(map inc [1 2 3])
5;; => (2 3 4)

Then load one project namespace from your editor. That final step proves the terminal setup and editor-connected REPL are aligned.

Knowledge Check

### Why is `clojure --version` not enough by itself? - [x] It verifies the CLI version, but not necessarily the language version used inside a project REPL. - [ ] It deletes dependencies. - [ ] It only works in Leiningen projects. - [ ] It compiles Java source code. > **Explanation:** CLI tooling and Clojure language dependencies are separate layers. ### What does `(System/getProperty "java.home")` confirm inside a REPL? - [x] The Java home used by the actual running JVM process. - [ ] The path to the current namespace file. - [ ] The Maven Central URL. - [ ] The editor theme. > **Explanation:** It confirms the JVM that hosts your REPL, which can differ from the terminal or IDE setting you expected. ### When should you verify Leiningen? - [x] When the project uses `project.clj` or documents `lein` commands. - [ ] Before every CLI-only project. - [ ] Only after deleting `deps.edn`. - [ ] Never, because Leiningen cannot start a REPL. > **Explanation:** Verify the toolchain your project actually uses.
Revised on Saturday, May 23, 2026