coursier
coursier copied to clipboard
CS finds a JVM in a folder that doesn't exit
On my Mac, when I run:
$ cs setup
Checking if a JVM is installed
Found a JVM installed under /Users/auser/Library/Caches/Coursier/jvm/[email protected]/Contents/Home
But that folder doesn't exist:
$ ls /Users/auser/Library/Caches/Coursier/jvm/[email protected]/Contents/Home
ls: /Users/auser/Library/Caches/Coursier/jvm/[email protected]/Contents/Home: No such file or directory
Despite installing the JVM with the setup command, there is no JVM:
$ java -version
No Java runtime present, requesting install.
I can select and install another JVM and manually configure it.
$ cs java --available | grep -e 11
$ cs java --jvm 11
$ cs java --jvm 11 --env >> .zshrc
$ source .zshrc
$ java -version
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode)
But it seems that the initial "cs setup" command said that it did its job but didn't. And it reports that a JVM is installed that isn't.
It seems that cs setup
uses the PATH along with JAVA_HOME
environment variable to check if a JVM is installed.
In case it finds the JAVA_HOME
environment variable in the shell profile, it seems to assume that a JVM is installed without actually checking for one or see if the one specified in the path can actually be run.
Removing the environment variables set by coursier from the shell profile seems to fix the issue.
I am on Windows 11 and struck this exact problem. The solution given by @thedataenginerd works perfectly here as well, thank you for saving me hours!
Be sure to check all environment variables, my computer had the path defined in multiple places.
I have no idea where cs
writes to, is there some documentation on where this is?