javapowershellclojurepath-variables

Trying to run a clojure project on emacs but Java error: Cannot run program powershell.exe


I am trying to run a clojure jar file on emacs using cider and I get the error below:

ERROR:ERROR:  Unhandled REPL handler exception processing messageUnhandled REPL handler exception processing message  {{:op:op  init-debuggereval, , :code cljs.core/demunge, :session 9f9a0db9-8cc7-4cf0-b0ba-f426b163fb52, :id :nrepl.middleware.print/stream?7 }1
, :nrepl.middleware.print/print cider.nrepl.pprint/pprint, :nrepl.middleware.print/quota 1048576, :nrepl.middleware.print/buffer-size 4096, :nrepl.middleware.print/options {:right-margin 70}, :session 2f97cb2f-b111-4c37-8658-b63045c9ab2a, :id 6}
Syntax error macroexpanding at (clojuredocs.clj:19:32).

Caused by: java.io.IOException: Cannot run program "powershell.exe": CreateProcess error=2, The system cannot find the file specified

I have powershell route set on my env PATH both on System envs and User envs as follow:

enter image description here

Java version: "20.0.1"

I am not sure what I am missing to be able to run the command cider-jack-in successfully


Solution

  • Mathias R. Jessen provided the crucial pointer in a comment:

    The special PATH[1] environment variable (accessible in PowerShell at the process level as $env:PATH - see the conceptual about_Environment_Variables help topic) - on both Windows and Unix-like platforms - contains a list of (usually absolute) directory paths in which the platform APIs look for executables when an attempt is made to invoke an executable by file name only (rather than, unambiguously, by a file path).

    General information:


    [1] The exact case on Windows is Path, whereas on Unix-like platforms it is PATH. Since environment-variable access in Windows is case-insensitive, whereas on Unix it is case-sensitive, the form PATH works on both platforms.