Use JAVA_HOME instead of JAVA_CMD in windows bat file?
I find it weird that lein uses JAVA_CMD as the environment variable to find the path to Java if java isn't on the path. It is more standard to have JAVA_HOME point to the Java install. Only lein uses JAVA_CMD. Even the official Java doc mentions JAVA_HOME: https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/
Could we not change lein so it also checks JAVA_HOME?
Sure; I haven't used many other java systems that do this, but if it's a common idiom then I'd take a patch to make it work this way. The only caveat is that it should be supported consistently across all the different implementations, and that JAVA_CMD should still take precedence if set, because it's more specific.
In my experience this is a common idiom, there's even java_home program that comes with Java for determining the directory of your Java home if you have multiple JDK's installed. For one third-party example, see Cassandra.
$ /usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
Guess we could get that in for the next minor release and deprecate JAVA_CMD for 3.0?
Yeah, I would take a patch for this.
@technomancy !USERPROFILE! in lein.bat should be replaced with %USERPROFILE%