Start standalone, project-connected, Leiningen, Clojure CLI, and editor-connected REPL sessions, and choose the mode that matches the code and classpath you need.
Starting a REPL is easy. Starting the right REPL is the important habit. A standalone REPL is enough for language experiments. A project-connected REPL is what you need when code depends on project paths, dependencies, resources, tests, or editor integration.
| Need | Start this |
|---|---|
| Try basic syntax or data transforms | Standalone terminal REPL with clj |
Work inside a deps.edn project |
Project REPL from the project root |
| Work inside a Leiningen project | lein repl from the project root |
| Evaluate directly from editor buffers | Editor-connected REPL |
| Run automation or scripts | Usually clojure, not clj |
The wrong REPL often looks like a Clojure problem, but it is usually a classpath problem.
For terminal exploration:
1clj
You should see a prompt like:
1Clojure 1.12.5
2user=>
Use this when you do not need project code. It is ideal for small experiments:
1(require '[clojure.string :as str])
2(str/upper-case "repl")
3;; => "REPL"
Exit with Ctrl-D.
From a project root that has deps.edn:
1clj
That gives you the base project classpath from :paths and :deps. If your project defines aliases, start with the alias you need:
1clj -M:dev
or inspect the resulting classpath:
1clojure -Spath
2clojure -A:dev -Spath
For Java engineers, this is like asking: “Which source roots and dependencies are in this running JVM?”
From a directory with project.clj:
1lein repl
This starts a REPL with the Leiningen project classpath. Use this when the repository README or CI uses lein commands.
Do not mix project tools casually:
| Project file | Default REPL command |
|---|---|
deps.edn |
clj or documented Clojure CLI alias |
project.clj |
lein repl |
| Both | Follow README and CI |
Most serious Clojure work happens through an editor-connected REPL:
| Editor | Common entry point |
|---|---|
| IntelliJ IDEA + Cursive | Run or connect a Clojure REPL configuration |
| VS Code + Calva | Jack in or connect to a running REPL |
| Emacs + CIDER | cider-jack-in or connect to nREPL |
The exact UI changes over time, but the invariant is stable: the editor must connect to the same project classpath you would use from the terminal.
After starting, verify with small checks:
1(System/getProperty "java.version")
2*ns*
3(require '[your-project.core :as core])
If a namespace cannot load, check:
| Symptom | Likely cause |
|---|---|
Could not locate ... on classpath |
Wrong directory, wrong alias, or namespace/file mismatch |
| Dependency namespace cannot load | Missing dependency or alias |
| Editor works but terminal fails | Different command or classpath |
| Terminal works but editor fails | Editor REPL not using project config |
clj for quick terminal REPL work.lein repl for Leiningen projects.