Browse Learn Clojure Foundations as a Java Developer

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.

Most Java setup failures are selection problems, not mysterious JVM behavior. The wrong Java executable wins on PATH, JAVA_HOME points to an old install, the editor uses a different SDK, or the Clojure CLI cannot reach Maven repositories.

Start by reducing the problem to a terminal command. Then add the editor, build tool, and REPL back one at a time.

Quick Diagnosis Table

Symptom Likely cause First check
java not found JDK not installed or not on PATH which java / where java
javac not found JRE-only install or JDK bin missing javac -version
Java version is unexpected Multiple JDKs installed command location and JAVA_HOME
Terminal works, editor REPL fails Editor uses different JDK or working directory REPL (System/getProperty "java.home")
Dependency downloads fail Proxy, certificate, network, or repository issue Maven/Clojure tool error text
Works locally, fails in CI CI Java setup differs CI Java version and setup action/image

Do not change five things at once. Make one change, open a new terminal or restart the affected tool, then verify again.

Wrong Java Version

When multiple JDKs exist, the first executable on PATH usually wins. Check both the version and location:

1java -version
2which java

On Windows:

1java -version
2where java

If the wrong JDK appears, fix the selection mechanism your team uses: package manager, version manager, system environment variables, shell profile, IDE project SDK, or CI setup. Avoid patching one terminal window with temporary commands and calling the environment fixed.

Missing javac

If java works but javac fails, you probably have either:

  • a runtime image instead of a JDK
  • a JDK installed but its bin directory is not on PATH
  • an editor or shell using a different Java home than expected

Install or select a full JDK, then verify both commands:

1java -version
2javac -version

Bad JAVA_HOME

JAVA_HOME should point to the JDK root. It should not point to bin, java, javac, or a project directory.

Bad value Why it fails
/path/to/jdk/bin Tools may append bin/java, producing a broken path
/path/to/jdk/bin/java Points to an executable, not the JDK root
Old removed JDK Tools fail even if java on PATH works
Different version than java -version Maven, Gradle, Clojure CLI, and editor may disagree

After changing JAVA_HOME, restart the terminal or tool that launches Clojure.

Editor And REPL Mismatch

If the terminal is correct but the editor-connected REPL is wrong, inspect the running JVM from Clojure:

1(System/getProperty "java.version")
2(System/getProperty "java.home")

Then adjust the editor’s project JDK, REPL launch command, or environment inheritance. This is a common source of false Clojure errors because the code is running, just not on the JVM you thought.

Dependency Download Problems

If Java works but Clojure dependencies fail, stop reinstalling Java and read the dependency error.

Common causes include:

  • corporate proxy settings
  • TLS/certificate inspection
  • repository access restrictions
  • misspelled Maven coordinates
  • stale classpath/dependency cache

The Clojure CLI has flags and commands for classpath and dependency diagnosis; use those when the failure is clearly in dependency resolution rather than Java discovery.

Team Troubleshooting Rule

When helping another developer, ask for these exact outputs:

1java -version
2javac -version

Then ask for the command location and the REPL Java properties if the editor is involved. Those four facts usually narrow the problem faster than a screen share of installer dialogs.

Knowledge Check

### What is the first thing to check when the wrong Java version appears? - [x] Which `java` executable is being selected by the shell or tool. - [ ] Whether Clojure syntax changed. - [ ] Whether the project has too many namespaces. - [ ] Whether Markdown is formatted. > **Explanation:** Version conflicts usually come from selection order: `PATH`, `JAVA_HOME`, version managers, editor settings, or CI images. ### Why can dependency download errors occur even when Java is installed correctly? - [x] Repository access, proxy, certificate, coordinates, or cache issues are separate from Java runtime discovery. - [ ] Java cannot run network code. - [ ] Clojure does not use Maven artifacts. - [ ] `javac` downloads all dependencies automatically. > **Explanation:** A working JVM can still fail to resolve dependencies if repository access or tool configuration is wrong. ### What should you do after changing `JAVA_HOME` or `PATH`? - [x] Restart the terminal or affected tool and verify again. - [ ] Assume every running process sees the update immediately. - [ ] Delete all source files. - [ ] Add a global `CLASSPATH`. > **Explanation:** Environment variables are captured when processes start. Existing terminals and editors may not see changes until restarted.
Revised on Saturday, May 23, 2026