Browse Learn Clojure Foundations as a Java Developer

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.

Clojure runs as JVM bytecode, so the first setup question is not “is Clojure installed?” It is “which Java runtime will this terminal, editor, build tool, and REPL actually use?”

For Java engineers, the useful check is deliberately simple:

1java -version
2javac -version

java proves that a JVM runtime is available. javac proves that a Java Development Kit (JDK) is available, not merely a runtime image. Clojure itself does not make you write Java first, but real JVM development is easier when the compiler, tools, and diagnostics are present.

What The Output Should Tell You

Command What it checks Healthy result
java -version Runtime selected by your shell A supported Java version from the JDK you expect
javac -version Compiler available on PATH Same major version as java
echo $JAVA_HOME or echo %JAVA_HOME% Explicit JDK home, if configured Root of the same JDK, not its bin directory
which java or where java Executable location A path that matches your intended JDK manager or install location

Official Clojure guidance currently treats Java 8 as the minimum and recommends Java 25; Clojure also supports Java LTS releases. For a learning machine, pick a current LTS JDK unless your workplace project requires another version.

JDK Versus JRE

Java teams often inherit machines with more than one Java install. The common failure is having java available but not javac.

If this happens Likely meaning Fix direction
java -version works, javac -version fails Runtime without full JDK, or JDK bin missing from PATH Install a JDK or fix PATH
Versions differ java and javac come from different installs Align PATH, JAVA_HOME, or version manager
Terminal works, IDE fails IDE has its own configured JDK Set the project/editor JDK explicitly
IDE works, terminal fails Shell startup files do not select the JDK Fix terminal environment first

Do this check from the terminal before relying on the editor. Clojure tooling is frequently launched from shell commands, build scripts, or editor integrations that inherit shell-like environment assumptions.

A Practical Check Sequence

Run these from the directory where you plan to create or open the Clojure project:

1java -version
2javac -version

On macOS or Linux, also inspect the executable:

1which java
2which javac

On Windows Command Prompt:

1where java
2where javac
3echo %JAVA_HOME%

On PowerShell:

1Get-Command java
2Get-Command javac
3$env:JAVA_HOME

The goal is consistency, not a particular vendor banner. If your Java team standardizes on Temurin, Oracle JDK, Microsoft Build of OpenJDK, Azul, or another distribution, Clojure does not care as long as a supported JDK is available and the classpath behaves normally.

What To Record For A Team

For a team repository, record the expected Java version in the README, build docs, or tool configuration. Do not rely on “whatever the developer has installed.”

Useful notes include:

  • expected Java major version
  • how the team installs or selects the JDK
  • command to verify the active version
  • whether the editor should use the same JDK as the terminal
  • how CI selects Java

That documentation prevents the most common Clojure onboarding problem: one developer runs a REPL on one JVM while tests, CI, or the editor use another.

Knowledge Check

### Why check both `java -version` and `javac -version`? - [x] `java` checks the runtime, while `javac` confirms a full JDK is available. - [ ] `javac` starts the Clojure REPL. - [ ] `java` only works on Windows. - [ ] They always print different versions. > **Explanation:** A runtime alone can launch some JVM programs, but a practical development setup should expose the JDK tools as well. ### What is the best first fix when the IDE uses one JDK and the terminal uses another? - [x] Align the configured JDKs and verify from the terminal and editor. - [ ] Delete the Clojure project. - [ ] Ignore the terminal because the IDE is always authoritative. - [ ] Set `CLASSPATH` globally for every project. > **Explanation:** Clojure workflows often combine terminal commands, editor REPLs, and build tools. They should agree on the JVM. ### What should `JAVA_HOME` usually point to? - [x] The root directory of the intended JDK installation. - [ ] The project `src` directory. - [ ] The Clojure dependency cache. - [ ] The Java `bin/java` executable file itself. > **Explanation:** Tools that consult `JAVA_HOME` expect the JDK root and then derive `bin/java` or other tool paths from it.
Revised on Saturday, May 23, 2026