Leiningen hangs instead of complaining about not finding JAVA_HOME
Initial debugging steps Before creating a report, especially around exceptions being thrown when running Leiningen, please check if the error still occurs after:
- [x] Updating to using the latest released version of Leiningen (
lein upgrade). - [x] Moving your
~/.lein/profiles.clj(if present) out of the way. This contains third-party dependencies and plugins that can cause problems inside Leiningen. - [x] Updating any old versions of plugins in your
project.clj, especially if the problem is with a plugin not working. Old versions of plugins like nREPL and CIDER (as well as others) can cause problems with newer versions of Leiningen. - [x] (If you are using Java 9 or newer), updating your dependencies to their most recent versions. Recent JDK's have introduced changes which can break some Clojure libraries.
Describe the bug
When I run any lein command (e.g. lein migrate) my terminal just hangs and no output is produced. After some debugging I found out that JAVA_HOME in my .zshrc was pointing to the wrong directory. Fixing the directory also fixed my problem.
To Reproduce Steps to reproduce the behavior:
- Go to your
.bashrc/.zshrc/etc and change theJAVA_HOMEdirectory to something else - Check
lein version- it should output the correct Java, e.g.Leiningen 2.11.2 on Java 1.8.0_401 Java HotSpot(TM) 64-Bit Server VMin my case - Run any
leincommand - e.g.lein test
Actual behavior
Any lein command produces no output and just hangs for minutes.
Expected behavior
lein commands to output a message about wrong Java directory
Link to sample project not relevant
Logs not relevant
Environment
- Leiningen Version:
Leiningen 2.11.2 on Java 1.8.0_401 Java HotSpot(TM) 64-Bit Server VM - Leiningen installation method: Homebrew
- JDK Version:
java version "1.8.0_401"
Java(TM) SE Runtime Environment (build 1.8.0_401-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.401-b10, mixed mode)
- OS: MacOS Sonoma 14.4.1 (Apple M3 Pro chip)
Additional context not relevant
I can't reproduce this running from source or installed from apt-get. Is it possible this is a distro-specific issue with the homebrew packaging?