Browse Clojure Foundations for Java Developers

Verifying Your Clojure Installation

Check Java, the Clojure CLI, and your first REPL before you lose time debugging the wrong layer.

When setup goes wrong, Java developers often lose time debugging the wrong thing. The fastest way to verify a Clojure environment is to check it in layers:

  1. the JDK
  2. the Clojure CLI
  3. the REPL
  4. optionally, Leiningen if you plan to use it

If you verify those in order, you can isolate most problems in a few minutes.

Step 1: Verify Java First

Clojure runs on the JVM, so if Java is missing or misconfigured, nothing above it will be reliable.

Run:

1java --version

What you want to confirm:

  • Java starts successfully
  • the command is on your PATH
  • the version shown is a supported JDK for current Clojure tooling

If this command fails, stop here and fix Java before touching Clojure-specific commands. The official install guide publishes the current supported Java LTS releases and installation recommendations.

Step 2: Verify The Clojure CLI

Next, verify that the Clojure command-line tools are installed:

1clojure --version

This prints the CLI version, not just the language version.

That distinction matters:

  • the CLI version is the tooling layer
  • the Clojure language version is what runs inside your REPL or program

Those versions are related, but they are not the same thing. Current official docs explicitly treat them as separate.

If clojure --version fails with “command not found”, your CLI installation is not complete yet even if Java is working.

Step 3: Start A Plain REPL

For interactive work, prefer clj:

1clj

The official CLI reference uses clj for REPL examples because it is the friendlier interactive entry point. In many setups it gives you better line editing behavior than clojure.

Once the REPL starts, you should see a prompt like:

1user=>

Now verify a few basics:

 1(clojure-version)
 2;; => "1.12.4"
 3
 4(+ 1 2 3)
 5;; => 6
 6
 7(map inc [1 2 3])
 8;; => (2 3 4)
 9
10(System/getProperty "java.version")
11;; => confirms which JVM the REPL is using

This tells you several important things at once:

  • the REPL starts
  • Clojure code evaluates
  • the default language version is what you expect
  • the running JVM is visible from inside Clojure

To exit, use Ctrl-D.

Step 4: Verify Classpath Resolution

One common failure mode is that the CLI exists, but dependency or classpath resolution is broken. A quick check is:

1clojure -Spath

This asks the CLI to compute and print the classpath it would use.

If this fails, the problem is often one of these:

  • malformed deps.edn
  • broken local configuration
  • blocked dependency downloads
  • proxy or certificate issues in a corporate environment

This check is especially helpful because it fails before you waste time wondering why a project REPL or app launch is broken.

Step 5: If You Use Leiningen, Verify It Separately

Leiningen is optional for many learners, but if your project or team uses it, verify it explicitly instead of assuming the Clojure CLI check was enough.

Start with:

1lein help

or, inside a Leiningen project:

1lein repl

If Leiningen needs to self-install supporting artifacts the first time, let it complete. Treat this as a separate layer from the Clojure CLI.

The important mental model is:

  • clj / clojure verifies the CLI workflow
  • lein verifies the Leiningen workflow

One passing does not guarantee the other.

A Good Minimal Verification Checklist

If you only want the shortest useful checklist:

1java --version
2clojure --version
3clj
4clojure -Spath

Inside the REPL:

1(clojure-version)
2(+ 1 2 3)

That is enough to prove the environment is fundamentally alive.

Common Failure Patterns

java --version works, but clojure --version fails

Java is installed, but the Clojure CLI is not on your PATH or was not installed correctly.

clojure --version works, but clj fails

The CLI may be installed, but the interactive wrapper or terminal setup is incomplete. This can also happen on systems where clj is not provided in the same way.

The REPL starts, but clojure -Spath fails

The installation exists, but dependency resolution or local configuration is broken.

Everything works except project startup in one repo

The machine is fine; the project config is probably the issue. Start reading deps.edn, project.clj, or local environment settings instead of reinstalling Java.

What Not To Do

  • do not debug editor integration before a plain terminal REPL works
  • do not assume a passing Java check means the CLI is installed
  • do not assume a passing CLI check means Leiningen is healthy
  • do not start by editing environment variables blindly without identifying which layer is actually broken

Verify the stack from bottom to top and the problem usually becomes obvious.

Knowledge Check: Verifying The Right Layer

### What should you verify first when setting up Clojure? - [x] Java - [ ] Leiningen - [ ] Your editor plugin - [ ] Git > **Explanation:** Clojure runs on the JVM, so the JDK is the foundation. If Java is broken, debugging the CLI or REPL is wasted effort. ### What does `clojure --version` primarily verify? - [x] That the Clojure CLI is installed and available - [ ] That your editor is connected to a REPL - [ ] That Leiningen is configured - [ ] That your project tests pass > **Explanation:** `clojure --version` checks the CLI tooling layer, not your editor integration or your project-specific workflow. ### Why is `(clojure-version)` useful inside the REPL? - [x] It tells you which Clojure language version the running REPL is actually using. - [ ] It prints the Leiningen version. - [ ] It prints your operating system. - [ ] It verifies Git configuration. > **Explanation:** The CLI version and the Clojure language version are related but distinct, so checking the running language version inside the REPL is useful. ### What does `clojure -Spath` help verify? - [x] Classpath and dependency resolution - [ ] Test coverage - [ ] JVM garbage collection settings - [ ] Source formatting > **Explanation:** `-Spath` forces the CLI to compute the classpath, which is a fast way to reveal configuration or dependency-resolution problems. ### If `clj` works but `lein repl` fails, what is the best conclusion? - [x] The CLI workflow works, but the Leiningen workflow still needs attention. - [ ] Clojure is fully broken. - [ ] Java must be reinstalled. - [ ] The REPL does not support project code. > **Explanation:** The Clojure CLI and Leiningen are separate layers. One can work while the other still has installation or configuration issues.
Revised on Friday, April 24, 2026