Browse Learn Clojure Foundations as a Java Developer

Install a JDK for Clojure

Choose and install a supported JDK for Clojure development without getting distracted by vendor debates, then verify that your shell, editor, and build tools use the same runtime.

If java -version or javac -version fails, install a JDK before installing Clojure. Clojure is hosted on the JVM, and the official Clojure tools expect Java to be available through PATH, JAVA_HOME, or a Java command override.

For most Java engineers, the decision is straightforward: install a current Long-Term Support (LTS) JDK unless a workplace project requires a specific version.

Choose The Version And Distribution

Decision Practical guidance
Java version Use a current LTS version for new learning and projects; respect project constraints in existing codebases
Distribution Any standards-compliant JDK distribution is fine for Clojure
Architecture Match your operating system and CPU architecture, especially on Apple Silicon or ARM Linux
Install method Prefer the method your team or package manager can reproduce
CI parity Make local Java match CI when possible

Official Clojure release guidance currently lists Java 8 as the minimum and recommends Java 25. The installation guide also notes support for Java LTS releases and says any Java distribution can work, including OpenJDK-based builds such as Temurin.

Installation Paths That Stay Maintainable

Avoid hand-copying random JDK folders into a place nobody remembers. Prefer a repeatable source:

Platform Good approach What to avoid
macOS Homebrew, vendor installer, or a version manager your team uses Mixing several installers without documenting which one wins
Linux Distribution packages, vendor packages, container base image, or team-standard version manager Manually unpacking archives into arbitrary locations without tracking upgrades
Windows Vendor MSI/installer, package manager, or team endpoint tooling Installing only a JRE when development tools are needed
CI Explicit setup step or base image Relying on whatever Java happens to be preinstalled

The best install is not the fanciest one. It is the one your future teammate can reproduce from the README.

After Installing

Open a new terminal and run:

1java -version
2javac -version

Then verify that Clojure tooling can find Java later:

1clj -h

If clj -h works after the Clojure CLI is installed, the CLI found a usable Java executable. If it fails, return to Java selection before debugging Clojure dependencies.

When You Need Multiple JDKs

Many Java teams run more than one JDK because old services, current services, and CI pipelines do not all move together. That is fine, but make selection explicit.

Use one of these patterns:

  • a version manager
  • shell profile configuration per project
  • CI configuration that names the Java version
  • editor project settings that point to the intended JDK
  • container images with a pinned JDK

Avoid relying on global machine state when a project has a real Java version requirement.

A Clojure-Specific Sanity Check

Clojure does not just “use Java” at runtime. The Clojure CLI computes classpaths, downloads Maven artifacts, starts JVM processes, and runs REPLs. A Java install is ready for Clojure only when these are true:

Requirement Why it matters
java is available The REPL and Clojure programs launch on the JVM
javac is available You have a full JDK and can compile Java interop helpers if needed
TLS/certificates work Maven dependencies can download
Terminal and editor agree REPL behavior matches command-line behavior
CI agrees Local success predicts pipeline success

Knowledge Check

### What JDK should a new Clojure learner usually choose? - [x] A current LTS JDK unless a project requires a specific version. - [ ] The oldest JDK available. - [ ] A beta JDK because it has the newest language features. - [ ] Any JRE without compiler tools. > **Explanation:** Clojure works across supported Java versions, but a current LTS JDK is the least surprising default for learning and team work. ### Why is the exact JDK distribution usually less important than consistency? - [x] Clojure needs a supported Java runtime; teams mainly need the same runtime across terminal, editor, build, and CI. - [ ] Clojure only runs on Oracle JDK. - [ ] Clojure ignores the JVM at runtime. - [ ] Different distributions use unrelated bytecode formats. > **Explanation:** Clojure is a JVM language. A supported JDK distribution works, but inconsistent selection creates hard-to-debug setup failures. ### What should you do immediately after installing a JDK? - [x] Open a new terminal and verify `java -version` and `javac -version`. - [ ] Start rewriting project code. - [ ] Set a global `CLASSPATH` for every project. - [ ] Delete older project dependencies. > **Explanation:** Verification catches path and version-selection problems before Clojure tooling adds another layer.
Revised on Saturday, May 23, 2026