Search code examples
clojureleiningen

leiningen trying to access old JDK when running "lein check"


I just updated my Java, and leiningen is still trying to access the old JDK, despite it being removed:

C:\Users\slomi\IdeaProjects\mandelbrot>lein check
java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_77\bin\java.exe" (in directory "C:\Users\slomi\IdeaProjects\mandelbrot"): CreateProcess error=2, The system cannot find the file specified

This doesn't appear to have anything to do with my IDE since I didn't run the above command inside the IDE.

Of course this seems like a PATH issue, but under User Variables, there's the entry:

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

Which seems, if anything, to be the entry I'd need to fix. It's also the only Java related path I can find besides a reference to "C:\ProgramData\Oracle\Java\javapath" in the System Variables.

Interestingly, lein uberjar works.

It must have the old path cached somewhere or something. Does anyone know how to fix this? check is a nice tool to have.


Solution

  • It ended up being more straightforward than I thought. In the System Variables, I found a reference to C:\Users\MY_USER_NAME\.lein\bin, and decided to poke around. Inside of the .lein folder was a profiles.clj file containing:

    {:user
      {
      :java-cmd "C:\\Program Files\\Java\\jdk1.8.0_77\\bin\\java.exe"
      :plugins [
    
        ]
       }
     }
    

    I just updated that path, and lein check immediately started working.