1
votes

Is there a way to force CIDER to use a particular version of the JVM?

I've been updating a number of projects to use the recently released Java 8 including some Clojure projects that depend on Java interop. However, I've run into some problems with some tools during development. One of those is when using CIDER from Emacs. I can't seem to get it to use a Java 8 JVM.

I have JDK versions 1.7.0_17, _21, _25, _40, _45, _51, and 1.8.0 installed on my system for compatibility testing.

When I launch a CIDER REPL and check the Java version, I see this:

; CIDER 0.6.0alpha (package: 20140322.332) (Clojure 1.6.0, nREPL 0.2.3)
eight-queens.core> (System/getProperty "java.version")
"1.7.0_25"

I saw similar results when using nREPL, before updating to CIDER. I see similar results when using the REPL within Light Table. Things work as expected using a Clojure REPL launched from the command line.

My Java-related environment variables include:

PATH contains: C:\Program Files\Java\jdk1.8.0\bin\

JAVA_HOME: C:\Program Files\Java\jdk1.8.0

LEIN_JAVA_CMD: C:\Program Files\Java\jdk1.8.0\bin\java

(Leiningen launched from a command shell within Emacs produced a similar problem before adding the LEIN_JAVA_CMD environment variable. Oddly, adding the environment variable changed the version of the JVM used by CIDER. Before adding the environment variable, it reported using version 1.7.0_40.)

I haven't found anything that seems to be relevant in the Windows registry.

Is there some way to force CIDER to run with a particular JVM short of uninstalling everything else?

1

1 Answers

1
votes

CIDER (or cider-jack-in to be more specific) uses lein to start the REPL (using the lein repl command). I'm not sure how the Windows cmd.exe, but I assume you haven't set LEIN_JAVA_CMD as a global env variable and that's why it doesn't affect the cmd.exe shell Emacs spins for lein repl.