Run a compact Java verification checklist before installing or debugging Clojure so runtime, compiler, PATH, JAVA_HOME, classpath behavior, and editor configuration are aligned.
After Java is installed, verify it from the same places that will launch Clojure: terminal, editor, build scripts, and CI. Verification is not ceremonial. It prevents setup bugs from masquerading as Clojure bugs.
Run these first:
1java -version
2javac -version
Then verify command locations:
1which java
2which javac
On Windows, use:
1where java
2where javac
If the Clojure CLI is already installed, add:
1clj -h
clj -h is useful because the Clojure CLI fails early if it cannot find Java.
| Check | Good result | If it fails |
|---|---|---|
java -version |
Supported Java runtime appears | Install/select a JDK or fix PATH |
javac -version |
Compiler appears and matches runtime major version | Install full JDK or fix PATH |
| Command location | Points to expected JDK manager or install path | Remove stale Java entries or reorder PATH |
JAVA_HOME |
Points to expected JDK root when used | Update shell, system, or project settings |
clj -h |
CLI help prints | Fix Java discovery before debugging Clojure |
This is also the point to document the result in the project README if the project requires a specific Java major version.
Your terminal can be correct while your editor still launches a REPL with a different JDK. That happens when the editor has its own project SDK, starts from a GUI environment that does not load shell files, or uses an embedded terminal with different startup behavior.
Check the editor by starting the project REPL and evaluating:
1(System/getProperty "java.version")
2(System/getProperty "java.home")
Compare that output with the terminal. If they differ, fix the editor configuration before interpreting Clojure errors.
Java installation verification is not only about versions. Clojure development depends on classpath construction. Later tools should be able to:
resources/If java works but dependencies fail to resolve, the Java runtime is probably not the problem. Check network/proxy/certificate settings, dependency coordinates, and the Clojure tool configuration.
When the machine is especially suspect, compile and run a tiny Java class:
1public class Smoke {
2 public static void main(String[] args) {
3 System.out.println(System.getProperty("java.version"));
4 }
5}
Then:
1javac Smoke.java
2java Smoke
This proves that the runtime and compiler can work together. Delete the generated files afterward; they are only setup diagnostics.