Fork me on GitHub

FWIW, a tool like jenv, whose intended use-case is to switch which JVM you're using from the command-line, not only sets $JAVA_HOME but also modifies $PATH to put the correct java binary first. It sounds like you were already using exec-path-from-shell to make emacs inherit the environment you configure for the shell. I wonder if whatever jenv was doing to modify $PATH was incompatible with something in cider (like, maybe there's a jenv directory on the $PATH with symlinks to actual java binaries on it?)


I've experimented with this myself on Debian because I didn't want to "switch" the global default JVM statefully using e.g. sudo update-java-alternatives -s adoptopenjdk-8-hotspot-amd64


and I discovered that I can launch a Clojure subprocess with any of the installed JVM versions, giving the same effect as update-java-alternatives but isolated to one process AOT a global stateful "default"


all I had to do to execute that Clojure subprocess with a particular JVM version was setting $PATH and $JAVA_HOME


thanks for the jenv info, yeah I am macOS but not quite a master of emacs, so when the shell in emacs and cider seem to do something differently I don't really know where to go, also tried digging through the cider source a bit but couldn't get any wiser. Oh well, it works without jenv anyway.