About clojure command searching for java order

The piece of code that search for the java executable in the clojure command, gives precedence to the System wide java command over the one in the JAVA_HOME.

Shouldn’t that be the opposite?

If you have JAVA_HOME set, the java command should respect that (so the clojure script is correct to try to find java first, and then use JAVA_HOME only if java is not on the path):

(! 564)-> env | fgrep JAVA
JAVA_HOME=/Developer/jdk8u192-b12/Contents/Home

Tue Jun 18 10:34:10
(sean)-(jobs:0)-(/Developer/workspace/wsmain/build)
(! 565)-> env | fgrep JDK
OPENJDK8_HOME=/Developer/jdk8u192-b12/Contents/Home
OPENJDK11_HOME=/Developer/jdk-11.0.1.jdk/Contents/Home

Tue Jun 18 10:34:14
(sean)-(jobs:0)-(/Developer/workspace/wsmain/build)
(! 566)-> JAVA_HOME=$OPENJDK11_HOME java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

Tue Jun 18 10:34:32
(sean)-(jobs:0)-(/Developer/workspace/wsmain/build)
(! 567)-> java -version
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_192-b12)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.192-b12, mixed mode)

Tue Jun 18 10:34:37
(sean)-(jobs:0)-(/Developer/workspace/wsmain/build)
(! 568)-> 
3 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.