Browse Learn Clojure Foundations as a Java Developer

Java Setup for Clojure

Make the JVM foundation boring and reliable by choosing a supported JDK, aligning terminal and editor settings, and verifying the same Java runtime across Clojure tools and Java builds.

Clojure runs on the JVM, so your REPL is just a JVM process. If you already have a working JDK for Java development, you may be done. If not, install a supported JDK and make sure your shell and tools agree on which one is active.

What To Verify

  • java -version reports the JDK you expect.
  • JAVA_HOME (if you use it) points to the same installation.
  • Your build tool (Maven/Gradle) and your Clojure tooling run on the same major version.
Check Why it matters in Clojure Common Java-team failure
Terminal JDK Clojure CLI, Leiningen, test runners, and scripts often start from the shell IDE uses one JDK while terminal commands use another
JAVA_HOME Some build tools and plugins still consult it It points to an older JRE or removed installation
Classpath behavior Clojure loads namespaces and dependencies through JVM classpath rules The app works in the IDE but cannot find code from the REPL
Certificates/proxy Dependency downloads use JVM/network settings Corporate proxy breaks dependency resolution

Practical rule: avoid “it works in my IDE but not in the terminal” by verifying everything from the terminal first.

Once the JVM is stable, the rest of the Clojure setup becomes straightforward.

In this section

  • Check Your Java Installation
    Confirm that your terminal can find a real JDK before installing Clojure, and learn what java, javac, PATH, and JAVA_HOME tell you about the JVM your tools will use.
  • 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.
  • Java Environment Variables
    Use PATH, JAVA_HOME, and optional Java selection variables deliberately so Clojure, Maven, Gradle, editors, and CI agree on the same JDK.
  • Verify Java for Clojure
    Run a compact Java verification checklist before installing or debugging Clojure so runtime, compiler, PATH, JAVA_HOME, classpath behavior, and editor configuration are aligned.
  • Fix Java Setup Issues
    Diagnose Java setup failures that block Clojure: wrong JDK selection, missing javac, stale PATH entries, bad JAVA_HOME, editor mismatch, dependency download problems, and permission errors.
Revised on Saturday, May 23, 2026